DayZ 1.24
Loading...
Searching...
No Matches
AITargetCallbacksPlayer.c
Go to the documentation of this file.
2{
4 {
6
7 m_iHeadBoneIndex = m_Player.GetBoneIndexByName("Head");
8 m_iChestBoneIndex = m_Player.GetBoneIndexByName("Spine3");
9 }
10
12 {
13 if (m_iHeadBoneIndex != -1)
14 return m_Player.GetBonePositionWS(m_iHeadBoneIndex);
15 else
16 return m_Player.GetPosition() + "0 1.7 0";
17 }
18
20 {
22 if (infected)
23 {
24 DayZInfectedInputController ic = infected.GetInputController();
25 if (ic)
26 {
27 int mindState = ic.GetMindState();
28 if (mindState >= DayZInfectedConstants.MINDSTATE_ALERTED)
29 return GetHeadPositionWS();
30 else
31 {
32 if (m_iChestBoneIndex != -1)
33 return m_Player.GetBonePositionWS(m_iChestBoneIndex);
34 }
35 }
36 }
37
38 return m_Player.GetPosition() + "0 1 0";
39 }
40
42 {
44 m_Player.GetMovementState(state);
45
46 float mod = 1.0;
49 float playerVisCoef = 1.0; //Use disabled since 1.12
50
53 {
54 case DayZPlayerConstants.MOVEMENTIDX_WALK:
56 break;
57
58 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
60 break;
61 }
62
64 switch (state.m_iStanceIdx)
65 {
66 case DayZPlayerConstants.STANCEIDX_CROUCH:
67 case DayZPlayerConstants.STANCEIDX_RAISEDCROUCH:
69 break;
70
71 case DayZPlayerConstants.STANCEIDX_PRONE:
72 case DayZPlayerConstants.STANCEIDX_RAISEDPRONE:
74 break;
75 }
76
78 mod = (speedCoef + stanceCoef) / 2;
79
80 return mod;
81 }
82
86 {
87 int movementSpeed = 0;
88
89 switch (pState.m_iStanceIdx)
90 {
91 case DayZPlayerConstants.STANCEIDX_CROUCH:
92 switch (pState.m_iMovement)
93 {
94 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
95 movementSpeed = DayZPlayerConstants.MOVEMENTIDX_IDLE;
96 break;
97
98 case DayZPlayerConstants.MOVEMENTIDX_WALK:
99 case DayZPlayerConstants.MOVEMENTIDX_RUN:
100 movementSpeed = DayZPlayerConstants.MOVEMENTIDX_WALK;
101 break;
102
103 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
104 movementSpeed = DayZPlayerConstants.MOVEMENTIDX_CROUCH_RUN;
105 break;
106 }
107 break;
108
109 case DayZPlayerConstants.STANCEIDX_PRONE:
110 switch (pState.m_iMovement)
111 {
112 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
113 movementSpeed = DayZPlayerConstants.MOVEMENTIDX_IDLE;
114 break;
115
116 default:
117 movementSpeed = DayZPlayerConstants.MOVEMENTIDX_WALK;
118 break;
119 }
120 break;
121
122 default:
123 movementSpeed = pState.m_iMovement;
124 }
125
126 return movementSpeed;
127 }
128
130 private int m_iHeadBoneIndex;
131 private int m_iChestBoneIndex;
132}
DayZInfectedConstants
Definition DayZInfected.c:2
override float GetMaxVisionRangeModifier(EntityAI pApplicant)
static int StanceToMovementIdxTranslation(HumanMovementState pState)
override vector GetVisionPointPositionWS(EntityAI pApplicant)
void AITargetCallbacksPlayer(PlayerBase pPlayer)
static const float AI_VISIBILITY_WALK
static const float AI_VISIBILITY_CROUCH
static const float AI_VISIBILITY_STANDING
static const float AI_VISIBILITY_RUN
static const float AI_VISIBILITY_IDLE
static const float AI_VISIBILITY_PRONE
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597