Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionmanagerbase.c
Go to the documentation of this file.
1class TSelectableActionInfoArray extends array<ref TSelectableActionInfo>
2{
3 bool IsSameAs(TSelectableActionInfoArray other)
4 {
5 if (this.Count() != other.Count())
6 {
7 return false;
8 }
9
10 for (int i = 0; i < Count(); ++i)
11 {
12 TSelectableActionInfo ai1 = this.Get(i);
13 TSelectableActionInfo ai2 = other.Get(i);
14
15 if (ai1.param2 != ai2.param2)
16 {
17 return false;
18 }
19
20 if (ai1.param3 != ai2.param3)
21 {
22 return false;
23 }
24 }
25
26 return true;
27 }
28}
29
30class ActionManagerBase
31{
33
34 protected ActionTarget m_TestedActionTarget;
36
38 protected ActionTarget m_PrimaryActionTarget;
41 protected ActionTarget m_SecondaryActionTarget;
46 ref TSelectableActionInfoArray m_SelectableActions;
50 static ref array<ref ActionBase> m_ActionsArray;
51 static ref map<typename, ActionBase> m_ActionNameActionMap;
52 protected bool m_ActionWantEndRequest;
53 protected bool m_ActionInputWantEnd;
54 protected bool m_ActionsEnabled;
55 protected bool m_ActionsAvaibale;
56 protected bool m_IsRestrictedLookLimits; // restricts head look/aim limits while performing an action
57
58 //Pending actions waiting for acknowledgment
60
61 protected ref ActionData m_CurrentActionData;
62
64 {
65 m_Player = player;
66 if (m_Player)
67 {
68 m_SelectableActions = new TSelectableActionInfoArray();
71
73
75 m_Interrupted = false;
76
78 if (!m_ActionsArray)
79 {
80 ac.ConstructActions(m_ActionsArray, m_ActionNameActionMap);
81 }
82
85 }
86
87 m_ActionsEnabled = true;
88 m_ActionsAvaibale = true;
89 }
90
91 ActionBase GetRunningAction()
92 {
94 return m_CurrentActionData.m_Action;
95
96 return null;
97 }
98
100 {
102 return m_CurrentActionData.m_MainItem;
103
104 return null;
105 }
106
107 void EnableActions(bool enable)
108 {
109 m_ActionsEnabled = enable;
110 }
111
112 void Update(int pCurrentCommandID)
113 {
115 {
116 if (m_Interrupted)
117 {
119 }
121 {
122 m_CurrentActionData.m_Action.OnUpdate(m_CurrentActionData);
123 }
124 }
125 else if (m_Interrupted)
126 {
127 m_Interrupted = false;
128 }
129
130 if (m_CurrentActionData) // again, can be nulled meanwhile
131 {
133 if (action && action.IsFullBody(m_Player) && action.IsCameraLockOnPerform())
134 {
136 {
137 Vector2 angleUD = action.GetCameraUDAngle();
138
140 m_Player.SetLookLimits(angleUD.x, angleUD.y, -160, 160);
141 m_Player.SetAimLimits(angleUD.x, angleUD.y, -180, 180);
142 }
143
144 return;
145 }
146 }
147
149 {
151 m_Player.SetLookLimits(-85, 85, -160, 160);
152 m_Player.SetAimLimits(-85, 85, -180, 180);
153 }
154 }
155
156 void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
157 {
158 int AcknowledgmentID;
159 switch (pJunctureID)
160 {
161 case DayZPlayerSyncJunctures.SJ_ACTION_ACK_ACCEPT:
162 pCtx.Read(AcknowledgmentID);
163 if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
165 break;
166 case DayZPlayerSyncJunctures.SJ_ACTION_ACK_REJECT:
167 pCtx.Read(AcknowledgmentID);
168 if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
170 break;
171 case DayZPlayerSyncJunctures.SJ_ACTION_INTERRUPT:
172 m_Interrupted = true;
173 break;
174 }
175 }
176
177 ActionTarget FindActionTarget();
179
180 static ActionBase GetActionVariant(typename actionName)
181 {
182 if (m_ActionNameActionMap)
183 {
184 ActionBase base_action = m_ActionNameActionMap.Get(actionName);
185 ActionBase new_action = ActionBase.Cast(actionName.Spawn());
186
187 new_action.CreateConditionComponents();
188 new_action.SetID(base_action.GetID());
189 new_action.SetInput(base_action.GetInput());
190
191 return new_action;
192 }
193 return null;
194 }
195
196 static ActionBase GetAction(typename actionName)
197 {
198 if (m_ActionNameActionMap)
199 return m_ActionNameActionMap.Get(actionName);
200
201 return null;
202 }
203
204 static ActionBase GetAction(int actionID)
205 {
206 return m_ActionsArray.Get(actionID);
207 }
208
213
218
219 TSelectableActionInfoArray GetSelectableActions()
220 {
221 return m_SelectableActions;
222 }
223
225 {
227 }
228
233 void SelectNextAction();
234 void SelectPrevAction();
237
242
243 //------------------------------------------------------
244 bool ActionPossibilityCheck(int pCurrentCommandID)
245 {
246 if (!m_ActionsEnabled || m_Player.IsSprinting() || m_Player.IsUnconscious() || m_Player.GetCommandModifier_Action() || m_Player.GetCommand_Action() || m_Player.IsEmotePlaying())
247 return false;
248
249 if (m_Player.GetWeaponManager().IsRunning() || m_Player.GetThrowing().IsThrowingAnimationPlaying() || m_Player.GetDayZPlayerInventory().IsProcessing() || m_Player.IsItemsToDelete() || m_Player.IsRolling())
250 return false;
251
252 return (pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_VEHICLE);
253 }
254 //------------------------------------------------------
255 protected void SetActionContext(ActionTarget target, ItemBase item)
256 {
257 m_TestedActionTarget = target;
258 m_TestedActionItem = item;
259 }
260
261 //------------------------------------------------------
262
264 {
266 {
267 return m_CurrentActionData.m_State;
268 }
269 return UA_NONE;
270 }
271
272 //---------------------------------
273 // EVENTS
274 //---------------------------------
278
280 {
281 m_Interrupted = true;
282 }
283
285 {
287 {
288 if(GetGame().IsMultiplayer())
289 {
291 }
292 else
293 {
295 }
296 }
297 }
299
300 protected void LocalInterrupt()
301 {
303 m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
304 else
305 m_Interrupted = false;
306 }
307
308 void OnInteractAction(); //Interact
309 void OnInstantAction(typename user_action_type, Param data = null);
310
312 {
313 if (LogManager.IsActionLogEnable())
314 {
316 Debug.ActionLog("Time stamp: " + m_CurrentActionData.m_Player.GetSimulationTimeStamp(), m_CurrentActionData.m_Action.ToString() , "n/a", "OnActionEnd", m_CurrentActionData.m_Player.ToString());
317 Debug.ActionLog("Action data cleared ", this.ToString() , "n/a", "ActionEnd", m_CurrentActionData.m_Player.ToString());
318 }
320 m_CurrentActionData.m_Action.ActionCleanup(m_CurrentActionData);
321 m_CurrentActionData = NULL;
322
323 m_Player.ResetActionEndInput();
324 }
325
328
329 bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
330 {
331 return false;
332 }
333
335 {
337 return m_CurrentActionData.m_Action.GetProgress(m_CurrentActionData);
338
339 return 0.0;
340 }
341
343 {
345 return m_CurrentActionData.m_Action.GetProgressWidgetMultiplier(m_CurrentActionData);
346
347 return 1;
348 }
349
351 {
353 return m_CurrentActionData.m_Action.GetState(m_CurrentActionData);
354
355 return UA_NONE;
356 }
357
358 ActionReciveData GetReciveData()
359 {
360 return null;
361 }
362}
override ActionBase GetAction()
override void SelectNextAction()
override void SelectPrevAction()
bool m_Interrupted
void RequestInterruptAction()
ItemBase m_SecondaryActionItem
ref ActionData m_CurrentActionData
ActionBase m_SecondaryAction
ActionTarget m_PrimaryActionTarget
bool m_TertiaryActionEnabled
void SelectFirstActionCategory()
void SetActionContext(ActionTarget target, ItemBase item)
bool IsSelectableActionsChanged()
bool m_ActionsEnabled
ItemBase GetRunningActionMainitem()
GetSelectedActionCategory()
int GetActionState()
ActionTarget m_TestedActionTarget
ActionBase GetContinuousAction()
void LocalInterrupt()
bool m_SelectableActionsHasChanged
void OnActionEnd()
void SelectNextActionCategory()
int GetSelectedActionIndex()
ActionTarget m_SecondaryActionTarget
bool m_ActionsAvaibale
void OnInstantAction(typename user_action_type, Param data=null)
void OnContinuousCancel()
void EnableActions(bool enable)
ActionTarget FindActionTarget()
float GetACProgressWidgetMultiplier()
int m_SelectedActionIndex
void SelectPrevActionCategory()
void InterruptNoSync()
ActionBase GetSingleUseAction()
void OnSingleUse()
void OnContinuousStart()
bool m_IsRestrictedLookLimits
bool m_SecondaryActionEnabled
bool m_ActionInputWantEnd
TSelectableActionInfoArray GetSelectableActions()
void RequestEndAction()
bool ActionPossibilityCheck(int pCurrentCommandID)
void OnInteractAction()
ref TSelectableActionInfoArray m_SelectableActions
void EndOrInterruptCurrentAction()
void EndActionInput()
float GetActionComponentProgress()
ActionReciveData GetReciveData()
void ActionManagerBase(PlayerBase player)
ItemBase m_TestedActionItem
void Interrupt()
void StartDeliveredAction()
int m_PendingActionAcknowledgmentID
bool m_PrimaryActionEnabled
bool m_ActionWantEndRequest
void OnJumpStart()
ItemBase m_PrimaryActionItem
ActionBase m_PrimaryAction
void SetID(int actionId)
ActionInput GetInput()
void SetInput(ActionInput ai)
Definition actionbase.c:220
void CreateConditionComponents()
Definition actionbase.c:230
DayZPlayerImplementThrowing GetThrowing()
WeaponManager GetWeaponManager()
DayZPlayerInventory GetDayZPlayerInventory()
Definition debug.c:2
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
proto string ToString()
proto native CGame GetGame()
const int UA_AM_ACCEPTED
Definition constants.c:477
const int UA_AM_REJECTED
Definition constants.c:478
const int UA_NONE
Definition constants.c:462
const int UA_AM_PENDING
Definition constants.c:476
DayZPlayer m_Player
Definition hand_events.c:42
override float Get()