Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AICombatMoveRequest.c
Go to the documentation of this file.
2 {
3  MOVE,
4  STOP,
7 }
8 
9 // Subtypes which can represent reason for this request
10 enum SCR_EAICombatMoveReason
11 {
12  STANDARD, // Moving somewhere during combat
13  FF_AVOIDANCE, // Friendly Fire avoidance
14  MOVE_FROM_TARGET, // Moving backwards from target
15  MOVE_FROM_DANGER, // Danger avoidance
17 }
18 
19 enum SCR_EAICombatMoveDirection
20 {
21  FORWARD, // Towards the target
22  BACKWARD, // Away from target
23  RIGHT,
24  LEFT,
25  ANYWHERE, // Without specific direciton, find any position close to current one
26  CUSTOM_POS //
27 }
28 
29 
30 //------------------------------------------------------------------------------------------------
32 void SCR_AICombatMoveRequest_OnCompleted(SCR_AIUtilityComponent utility, SCR_AICombatMoveRequestBase request);
33 
35 void SCR_AICombatMoveRequest_OnFailed(SCR_AIUtilityComponent utility, SCR_AICombatMoveRequestBase request, SCR_EAICombatMoveRequestFailReason failReason);
36 
38 {
39  SCR_EAICombatMoveRequestType m_eType; // Type int is needed for decoding in behavior tree
41  SCR_EAICombatMoveRequestFailReason m_eFailReason = SCR_EAICombatMoveRequestFailReason.NONE;
42  SCR_EAICombatMoveReason m_eReason; // "Reason" of request - abstract data to help identify our request in combat move logic
43 
44  // It can be used for various timings, up to sender of the request to decide what it means
45  float m_f_UserTimer_s;
46 
47  // Allowing or restricting aiming is common for all request types
48  bool m_bAimAtTarget; // Aim at target while executing the request?
49  bool m_bAimAtTargetEnd; // Aim at target after request is executed?
50 
51  // Events
52  protected ref ScriptInvokerBase<SCR_AICombatMoveRequest_OnCompleted> m_OnCompleted;
53  protected ref ScriptInvokerBase<SCR_AICombatMoveRequest_OnFailed> m_OnFailed;
54 
56  ScriptInvokerBase<SCR_AICombatMoveRequest_OnCompleted> GetOnCompleted(bool createInvoker = true)
57  {
58  if (!m_OnCompleted && createInvoker)
59  m_OnCompleted = new ScriptInvokerBase<SCR_AICombatMoveRequest_OnCompleted>();
60  return m_OnCompleted;
61  }
62 
64  ScriptInvokerBase<SCR_AICombatMoveRequest_OnFailed> GetOnFailed(bool createInvoker = true)
65  {
66  if (!m_OnFailed && createInvoker)
67  m_OnFailed = new ScriptInvokerBase<SCR_AICombatMoveRequest_OnFailed>();
68  return m_OnFailed;
69  }
70 }
71 
72 
73 //------------------------------------------------------------------------------------------------
74 // Movement with potential cover search
76 void SCR_AICombatMoveRequest_Move_MovementEvent(SCR_AIUtilityComponent utility, SCR_AICombatMoveRequest_Move request, vector movePos, bool destinationIsCover);
77 
79 {
80  vector m_vTargetPos; // Position of target (enemy) - must be useable for cover search, should be muzzle position or head position.
81  vector m_vMovePos; // Move position relative to which m_eDirection works
82  bool m_bTryFindCover; // Try to find cover or not?
83  bool m_bFailIfNoCover; // If m_bTryFindCover is true, but cover was not found, fail or move anyway?
84  bool m_bCheckCoverVisibility; // (only m_bTryFindCover) Do we need to check target pos. visibility from that cover or not?
85  ECharacterStance m_eStanceMoving; // Stance used for movement
86  ECharacterStance m_eStanceEnd; // Stance used at the end (might be overridden by found cover)
87  EMovementType m_eMovementType; //
88  float m_fCoverSearchDistMin; // (only m_bTryFindCover)
89  float m_fCoverSearchDistMax; // (only m_bTryFindCover)
90  float m_fCoverSearchSectorHalfAngleRad = Math.PI; // (only m_bTryFindCover) Half-angle (in radians) of cover query sector. Pi is full circle, Pi/2 is -90deg...+90deg sector.
91  float m_fMoveDistance; // Movement distance if for movement to non-cover position
92  bool m_bUseCoverSearchDirectivity; // If trying to find cover, prefer covers in given direction or not. Affects cover scoring.
93  SCR_EAICombatMoveDirection m_eDirection;// Direction - Where we want to move !!! relative to m_vMovePos
94 
95  // Events
96  protected ref ScriptInvokerBase<SCR_AICombatMoveRequest_Move_MovementEvent> m_OnMovementStarted;
97 
99  {
101  }
102 
103  // Called right before move node starts
104  ScriptInvokerBase<SCR_AICombatMoveRequest_Move_MovementEvent> GetOnMovementStarted(bool createInvoker = true)
105  {
106  if (!m_OnMovementStarted && createInvoker)
107  m_OnMovementStarted = new ScriptInvokerBase<SCR_AICombatMoveRequest_Move_MovementEvent>();
108  return m_OnMovementStarted;
109  }
110 }
111 
112 //------------------------------------------------------------------------------------------------
114 {
116  {
118  }
119 }
120 
121 //------------------------------------------------------------------------------------------------
122 // Changes stance when we are in cover
124 {
125  bool m_bExposedInCover;
126 
128  {
129  m_eType = SCR_EAICombatMoveRequestType.CHANGE_STANCE_IN_COVER;
130  }
131 }
132 
133 //------------------------------------------------------------------------------------------------
135 {
137 
139  {
140  m_eType = SCR_EAICombatMoveRequestType.CHANGE_STANCE;
141  }
142 }
MOVE_FROM_TARGET
enum SCR_EAICombatMoveRequestType MOVE_FROM_TARGET
CHANGE_STANCE
@ CHANGE_STANCE
Definition: SCR_AICombatMoveRequest.c:6
m_OnMovementStarted
protected ref ScriptInvokerBase< SCR_AICombatMoveRequest_Move_MovementEvent > m_OnMovementStarted
Definition: SCR_AICombatMoveRequest.c:93
SCR_AICombatMoveRequest_Move_MovementEvent
class SCR_AICombatMoveRequestBase SCR_AICombatMoveRequest_Move_MovementEvent
BACKWARD
enum SCR_EAICombatMoveRequestType BACKWARD
EMovementType
EMovementType
Definition: EMovementType.c:12
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
SCR_AICombatMoveRequestBase
Definition: SCR_AICombatMoveRequest.c:37
FF_AVOIDANCE
enum SCR_EAICombatMoveRequestType FF_AVOIDANCE
STOP
@ STOP
Definition: SCR_AICombatMoveRequest.c:4
func
func
Definition: SCR_AIThreatSystem.c:5
FORWARD
enum SCR_EAICombatMoveRequestType FORWARD
SUPPRESSED_IN_COVER
enum SCR_EAICombatMoveRequestType SUPPRESSED_IN_COVER
SCR_AICombatMoveRequest_OnFailed
func SCR_AICombatMoveRequest_OnFailed
Definition: SCR_AICombatMoveRequest.c:34
SCR_AICombatMoveRequest_ChangeStanceInCover
Definition: SCR_AICombatMoveRequest.c:123
m_eStance
SCR_AICombatMoveRequest_ChangeStanceInCover m_eStance
SCR_AICombatMoveRequest_Stop
SCR_AICombatMoveRequest_Move SCR_AICombatMoveRequestBase SCR_AICombatMoveRequest_Stop()
Definition: SCR_AICombatMoveRequest.c:115
SCR_AICombatMoveRequest_ChangeStance
void SCR_AICombatMoveRequest_ChangeStance()
Definition: SCR_AICombatMoveRequest.c:138
SCR_AICombatMoveRequest_Move
Definition: SCR_AICombatMoveRequest.c:78
MOVE_FROM_DANGER
enum SCR_EAICombatMoveRequestType MOVE_FROM_DANGER
ANYWHERE
enum SCR_EAICombatMoveRequestType ANYWHERE
SCR_AICombatMoveRequest_OnCompleted
enum SCR_EAICombatMoveRequestType SCR_AICombatMoveRequest_OnCompleted
m_eType
protected SCR_ECampaignBaseType m_eType
Definition: SCR_CampaignMilitaryBaseComponent.c:59
SCR_EAICombatMoveRequestType
SCR_EAICombatMoveRequestType
Definition: SCR_AICombatMoveRequest.c:1
RIGHT
enum SCR_EAICombatMoveRequestType RIGHT
STANDARD
enum SCR_EAICombatMoveRequestType STANDARD
LEFT
enum SCR_EAICombatMoveRequestType LEFT
MOVE
@ MOVE
Definition: SCR_AICombatMoveRequest.c:3
SCR_EAICombatMoveRequestState
SCR_EAICombatMoveRequestState
Definition: SCR_AICombatMoveState.c:1
CHANGE_STANCE_IN_COVER
@ CHANGE_STANCE_IN_COVER
Definition: SCR_AICombatMoveRequest.c:5