DayZ 1.24
Loading...
Searching...
No Matches
AITargetCallbacksPlayer Class Reference
Inheritance diagram for AITargetCallbacksPlayer:
[legend]
Collaboration diagram for AITargetCallbacksPlayer:
[legend]

Private Member Functions

void AITargetCallbacksPlayer (PlayerBase pPlayer)
 
override vector GetHeadPositionWS ()
 
override vector GetVisionPointPositionWS (EntityAI pApplicant)
 
override float GetMaxVisionRangeModifier (EntityAI pApplicant)
 

Static Private Member Functions

static int StanceToMovementIdxTranslation (HumanMovementState pState)
 

Private Attributes

PlayerBase m_Player
 
int m_iHeadBoneIndex
 
int m_iChestBoneIndex
 

Detailed Description

Definition at line 1 of file AITargetCallbacksPlayer.c.

Constructor & Destructor Documentation

◆ AITargetCallbacksPlayer()

void AITargetCallbacksPlayer::AITargetCallbacksPlayer ( PlayerBase pPlayer)
inlineprivate

Definition at line 3 of file AITargetCallbacksPlayer.c.

4 {
6
7 m_iHeadBoneIndex = m_Player.GetBoneIndexByName("Head");
8 m_iChestBoneIndex = m_Player.GetBoneIndexByName("Spine3");
9 }

References m_iChestBoneIndex, m_iHeadBoneIndex, and m_Player.

Member Function Documentation

◆ GetHeadPositionWS()

override vector AITargetCallbacksPlayer::GetHeadPositionWS ( )
inlineprivate

Definition at line 11 of file AITargetCallbacksPlayer.c.

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 }

References m_iHeadBoneIndex, and m_Player.

Referenced by GetVisionPointPositionWS().

◆ GetMaxVisionRangeModifier()

override float AITargetCallbacksPlayer::GetMaxVisionRangeModifier ( EntityAI pApplicant)
inlineprivate

player speed mofifications

stance modification

mean value of the coefs

Definition at line 41 of file AITargetCallbacksPlayer.c.

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 }
static int StanceToMovementIdxTranslation(HumanMovementState pState)
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

References PlayerConstants::AI_VISIBILITY_CROUCH, PlayerConstants::AI_VISIBILITY_IDLE, PlayerConstants::AI_VISIBILITY_PRONE, PlayerConstants::AI_VISIBILITY_RUN, PlayerConstants::AI_VISIBILITY_STANDING, PlayerConstants::AI_VISIBILITY_WALK, m_Player, and StanceToMovementIdxTranslation().

◆ GetVisionPointPositionWS()

override vector AITargetCallbacksPlayer::GetVisionPointPositionWS ( EntityAI pApplicant)
inlineprivate

Definition at line 19 of file AITargetCallbacksPlayer.c.

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 }
DayZInfectedConstants
Definition DayZInfected.c:2

References GetHeadPositionWS(), m_iChestBoneIndex, and m_Player.

◆ StanceToMovementIdxTranslation()

static int AITargetCallbacksPlayer::StanceToMovementIdxTranslation ( HumanMovementState pState)
inlinestaticprivate

Translates players speed (idx) and corrects it by current stance used mainly for visibility/audibility of player to AI

Definition at line 85 of file AITargetCallbacksPlayer.c.

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 }

Referenced by GetMaxVisionRangeModifier(), GetMovementSpeedVisualCoef(), and NoiseAIEvaluate::GetNoiseMultiplierByPlayerSpeed().

Member Data Documentation

◆ m_iChestBoneIndex

int AITargetCallbacksPlayer::m_iChestBoneIndex
private

Definition at line 131 of file AITargetCallbacksPlayer.c.

Referenced by AITargetCallbacksPlayer(), and GetVisionPointPositionWS().

◆ m_iHeadBoneIndex

int AITargetCallbacksPlayer::m_iHeadBoneIndex
private

Definition at line 130 of file AITargetCallbacksPlayer.c.

Referenced by AITargetCallbacksPlayer(), and GetHeadPositionWS().

◆ m_Player

PlayerBase AITargetCallbacksPlayer::m_Player
private

The documentation for this class was generated from the following file: