Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AICombatMoveState.c
Go to the documentation of this file.
2{
3 IDLE, // There was never a request
4 EXECUTING, // Executing a request
5 SUCCESS, // Last request succeeded
6 FAIL, // Last request failed, see fail reason
7 CANCELED // It was aborted while running
8}
9
10enum SCR_EAICombatMoveRequestFailReason
11{
16}
17
18class SCR_AICombatMoveState
19{
20 // Check VerifyCurrentCover
21 protected static const float DISTANCE_IN_COVER_MAX_SQ = 1.0;
22
23 protected ref SCR_AICoverLock m_CoverLock; // Cover assigned to us. But it doesn't mean we are at the cover position (yet).
24
26
27 bool m_bInCover; // True if we are in cover
28 bool m_bExposedInCover; // If in cover, false means we are hidden behind cover completely, true means we are exposed and can shoot
29 bool m_bAimAtTarget = true; // True if we are allowed to aim at target due to combat movement constraints. Enabled at start!
30
31 // Timers
32 float m_fTimerRequest_s; // Time since last request
33 float m_fTimerInCover_s; // Counts up when we are in cover
34 float m_fTimerStopped_s; // Counts up when we are not moving, no matter if in cover or not
35
36
37 //----------------------------------------------------------------
39 {
40 if (m_CoverLock)
41 m_CoverLock.Release();
42
43 m_CoverLock = newCover;
44 }
45
46 //----------------------------------------------------------------
48 {
49 // m_CoverLock might be still referenced by something else,
50 // Thus if we only unref it, it might still be not destroyed.
51 // That's why we also release it manually here.
52
53 if (m_CoverLock)
54 m_CoverLock.Release();
55 m_CoverLock = null;
56 m_bInCover = false;
57 }
58
59 //----------------------------------------------------------------
61 {
62 // mark old request as cancelled if it was running, in case something else needs to know its state
63 if (m_Request && m_Request.m_eState == SCR_EAICombatMoveRequestState.EXECUTING)
64 m_Request.m_eState = SCR_EAICombatMoveRequestState.CANCELED;
65
66 m_Request = request; // Old request is unreferenced here
67 }
68
69 //----------------------------------------------------------------
73 {
74 if (m_Request && m_Request.m_eState == SCR_EAICombatMoveRequestState.EXECUTING)
75 m_Request.m_eState = SCR_EAICombatMoveRequestState.CANCELED;
76
77 m_Request = null;
78 }
79
80 //----------------------------------------------------------------
81 void EnableAiming(bool enable)
82 {
83 m_bAimAtTarget = enable;
84 }
85
86 //----------------------------------------------------------------
90 {
92 {
93 if (vector.DistanceSq(myPos, m_CoverLock.GetPosition()) > DISTANCE_IN_COVER_MAX_SQ)
94 {
96 }
97 }
98 }
99
100
101 //-------------------------------------------------------------------------------
102 // Getters
103
104 bool IsMoving()
105 {
106 // Moving when executing a MOVE request
108 }
109
110 bool IsMoving(SCR_EAICombatMoveReason eReason)
111 {
113 return rqMove && rqMove.m_eState == SCR_EAICombatMoveRequestState.EXECUTING && rqMove.m_eReason == eReason;
114 }
115
117 {
119 return moveRequest && moveRequest.m_eState == SCR_EAICombatMoveRequestState.EXECUTING && m_CoverLock;
120 }
121
123 {
124 return m_bInCover && m_CoverLock && m_CoverLock.IsValid();
125 }
126
128 {
129 return m_bInCover && !m_bExposedInCover && m_CoverLock && m_CoverLock.IsValid();
130 }
131
133 {
134 return m_Request && m_Request.m_eState == SCR_EAICombatMoveRequestState.EXECUTING;
135 }
136
141
146
148 {
149 return m_CoverLock && m_CoverLock.IsValid();
150 }
151
152
153
154 //-------------------------------------------------------------------------------
155 // Helper methods for applying trivial requests
156
157 //----------------------------------------------------------------
159 {
161
162 rq.m_eStance = stance;
163 rq.m_bAimAtTarget = true;
164 rq.m_bAimAtTargetEnd = true;
165
166 ApplyNewRequest(rq);
167 }
168
169 //----------------------------------------------------------------
171 {
173
174 rq.m_bExposedInCover = exposed;
175 rq.m_bAimAtTarget = true;
176 rq.m_bAimAtTargetEnd = true;
177
178 ApplyNewRequest(rq);
179 }
180}
void SCR_AICombatMoveRequest_ChangeStance()
float m_fTimerStopped_s
SCR_AICoverLock GetAssignedCover()
bool IsAssignedCoverValid()
enum SCR_EAICombatMoveRequestState UNDEFINED
void ApplyNewRequest(notnull SCR_AICombatMoveRequestBase request)
SCR_AICombatMoveRequestBase GetRequest()
void EnableAiming(bool enable)
void VerifyCurrentCover(vector myPos)
void ApplyRequestChangeStanceInCover(bool exposed)
void AssignCover(SCR_AICoverLock newCover)
bool IsExecutingRequest()
enum SCR_EAICombatMoveRequestState MOVEMENT_FAILED
bool IsInValidCover()
SCR_EAICombatMoveRequestState
@ CANCELED
Job was canceled and will not do any additional actions.
enum SCR_EAICombatMoveRequestState COVER_NOT_FOUND
void CancelRequest()
bool IsMoving()
float m_fTimerInCover_s
float m_fTimerRequest_s
bool IsMovingToCover()
ref SCR_AICombatMoveRequestBase m_Request
ref SCR_AICoverLock m_CoverLock
bool IsHidingInValidCover()
bool m_bAimAtTarget
bool m_bExposedInCover
void ApplyRequestChangeStanceOutsideCover(ECharacterStance stance)
void ReleaseCover()
enum SCR_EAICombatMoveRequestState DISTANCE_IN_COVER_MAX_SQ
bool m_bInCover
SCR_AIGroupInfoComponentClass IDLE
Group has no waypoints and does not engage an enemy.
ECharacterStance
@ NONE
When Shape is created and not initialized yet.
Definition ShapeType.c:15