Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionmanagerbase.c
Go to the documentation of this file.
1 class 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 
31 {
33 
36 
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 
57  //Pending actions waiting for acknowledgment
59 
61 
63  {
64  m_Player = player;
65  if (m_Player)
66  {
67  m_SelectableActions = new TSelectableActionInfoArray();
70 
72 
73  m_CurrentActionData = NULL;
74  m_Interrupted = false;
75 
77  if (!m_ActionsArray)
78  {
79  ac.ConstructActions(m_ActionsArray, m_ActionNameActionMap);
80  }
81 
82  m_ActionWantEndRequest = false;
83  m_ActionInputWantEnd = false;
84  }
85 
86  m_ActionsEnabled = true;
87  m_ActionsAvaibale = true;
88  }
89 
91  {
93  return m_CurrentActionData.m_Action;
94 
95  return null;
96  }
97 
99  {
101  return m_CurrentActionData.m_MainItem;
102 
103  return null;
104  }
105 
106  void EnableActions(bool enable)
107  {
108  m_ActionsEnabled = enable;
109  }
110 
111  void Update(int pCurrentCommandID)
112  {
114  {
115  if (m_Interrupted)
116  {
117  LocalInterrupt();
118  }
120  {
121  m_CurrentActionData.m_Action.OnUpdate(m_CurrentActionData);
122  }
123  }
124  else if (m_Interrupted)
125  {
126  m_Interrupted = false;
127  }
128  }
129 
130  void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
131  {
132  int AcknowledgmentID;
133  switch (pJunctureID)
134  {
135  case DayZPlayerSyncJunctures.SJ_ACTION_ACK_ACCEPT:
136  pCtx.Read(AcknowledgmentID);
137  if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
139  break;
140  case DayZPlayerSyncJunctures.SJ_ACTION_ACK_REJECT:
141  pCtx.Read(AcknowledgmentID);
142  if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
144  break;
145  case DayZPlayerSyncJunctures.SJ_ACTION_INTERRUPT:
146  m_Interrupted = true;
147  break;
148  }
149  }
150 
152  void StartDeliveredAction();
153 
154  static ActionBase GetActionVariant(typename actionName)
155  {
156  if (m_ActionNameActionMap)
157  {
158  ActionBase base_action = m_ActionNameActionMap.Get(actionName);
159  ActionBase new_action = ActionBase.Cast(actionName.Spawn());
160 
161  new_action.CreateConditionComponents();
162  new_action.SetID(base_action.GetID());
163  new_action.SetInput(base_action.GetInput());
164 
165  return new_action;
166  }
167  return null;
168  }
169 
170  static ActionBase GetAction(typename actionName)
171  {
172  if (m_ActionNameActionMap)
173  return m_ActionNameActionMap.Get(actionName);
174 
175  return null;
176  }
177 
178  static ActionBase GetAction(int actionID)
179  {
180  return m_ActionsArray.Get(actionID);
181  }
182 
184  {
185  return m_PrimaryAction;
186  }
187 
189  {
190  return m_SecondaryAction;
191  }
192 
193  TSelectableActionInfoArray GetSelectableActions()
194  {
195  return m_SelectableActions;
196  }
197 
199  {
200  return m_SelectedActionIndex;
201  }
202 
203  typename GetSelectedActionCategory();
207  void SelectNextAction();
208  void SelectPrevAction();
209  void RequestEndAction();
210  void EndActionInput();
211 
213  {
215  }
216 
217  //------------------------------------------------------
218  bool ActionPossibilityCheck(int pCurrentCommandID)
219  {
220  if (!m_ActionsEnabled || m_Player.IsSprinting() || m_Player.IsUnconscious() || m_Player.GetCommandModifier_Action() || m_Player.GetCommand_Action() || m_Player.IsEmotePlaying() || m_Player.GetThrowing().IsThrowingAnimationPlaying() || m_Player.GetDayZPlayerInventory().IsProcessing() || m_Player.IsItemsToDelete())
221  return false;
222 
223  if (m_Player.GetWeaponManager().IsRunning())
224  return false;
225 
226  return (pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_VEHICLE);
227  }
228  //------------------------------------------------------
229  protected void SetActionContext(ActionTarget target, ItemBase item)
230  {
231  m_TestedActionTarget = target;
232  m_TestedActionItem = item;
233  }
234 
235  //------------------------------------------------------
236 
238  {
240  {
241  return m_CurrentActionData.m_State;
242  }
243  return UA_NONE;
244  }
245 
246  //---------------------------------
247  // EVENTS
248  //---------------------------------
249  void OnContinuousStart();
250  void OnContinuousCancel();
251  void OnSingleUse();
252  void Interrupt();
253 
254  protected void LocalInterrupt()
255  {
257  m_CurrentActionData.m_Action.Interrupt(m_CurrentActionData);
258  else
259  m_Interrupted = false;
260  }
261 
262  void OnInteractAction(); //Interact
263  void OnInstantAction(typename user_action_type, Param data = null);
264 
265  void OnActionEnd()
266  {
267  if (LogManager.IsActionLogEnable())
268  {
270  Debug.ActionLog("n/a", m_CurrentActionData.m_Action.ToString() , "n/a", "OnActionEnd", m_CurrentActionData.m_Player.ToString());
271  Debug.ActionLog("Action data cleared ", this.ToString() , "n/a", "ActionEnd", m_CurrentActionData.m_Player.ToString());
272  }
274  m_CurrentActionData.m_Action.ActionCleanup(m_CurrentActionData);
275  m_CurrentActionData = NULL;
276 
277  m_Player.ResetActionEndInput();
278  }
279 
280  void OnJumpStart();
281 
282  bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
283  {
284  return false;
285  }
286 
288  {
290  return m_CurrentActionData.m_Action.GetProgress(m_CurrentActionData);
291 
292  return 0.0;
293  }
294 
296  {
298  return m_CurrentActionData.m_Action.GetState(m_CurrentActionData);
299 
300  return UA_NONE;
301  }
302 
303  ActionReciveData GetReciveData()
304  {
305  return null;
306  }
307 }
ItemBase
Definition: inventoryitem.c:730
m_SelectedActionIndex
int m_SelectedActionIndex
Definition: actionmanagerbase.c:47
RequestEndAction
void RequestEndAction()
OnContinuousCancel
void OnContinuousCancel()
GetReciveData
ActionReciveData GetReciveData()
Definition: actionmanagerbase.c:303
m_SecondaryActionTarget
protected ActionTarget m_SecondaryActionTarget
Definition: actionmanagerbase.c:41
m_TestedActionItem
protected ItemBase m_TestedActionItem
Definition: actionmanagerbase.c:35
UA_AM_ACCEPTED
const int UA_AM_ACCEPTED
Definition: constants.c:447
SetActionContext
protected void SetActionContext(ActionTarget target, ItemBase item)
Definition: actionmanagerbase.c:229
m_TertiaryActionEnabled
bool m_TertiaryActionEnabled
Definition: actionmanagerbase.c:45
LogManager
Definition: debug.c:734
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
OnInstantAction
void OnInstantAction(typename user_action_type, Param data=null)
GetActionComponentProgress
float GetActionComponentProgress()
Definition: actionmanagerbase.c:287
m_CurrentActionData
protected ref ActionData m_CurrentActionData
Definition: actionmanagerbase.c:60
m_ActionsEnabled
protected bool m_ActionsEnabled
Definition: actionmanagerbase.c:54
OnJumpStart
void OnJumpStart()
m_ActionWantEndRequest
protected bool m_ActionWantEndRequest
Definition: actionmanagerbase.c:52
GetRunningAction
ActionBase GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
Definition: actionmanagerbase.c:90
m_Player
class TSelectableActionInfoArray extends array< ref TSelectableActionInfo > m_Player
Update
void Update(int pCurrentCommandID)
Definition: actionmanagerbase.c:111
GetContinuousAction
ActionBase GetContinuousAction()
Definition: actionmanagerbase.c:183
m_SelectableActions
ref TSelectableActionInfoArray m_SelectableActions
Definition: actionmanagerbase.c:46
SelectNextActionCategory
void SelectNextActionCategory()
ActionManagerBase
void ActionManagerBase(PlayerBase player)
Definition: actionmanagerbase.c:62
GetSelectedActionCategory
GetSelectedActionCategory()
m_PrimaryAction
protected ActionBase m_PrimaryAction
Definition: actionmanagerbase.c:37
Param3
Definition: entityai.c:95
ToString
proto string ToString()
SelectNextAction
void SelectNextAction()
Definition: actioninput.c:495
m_SecondaryAction
protected ActionBase m_SecondaryAction
Definition: actionmanagerbase.c:40
OnActionEnd
void OnActionEnd()
Definition: actionmanagerbase.c:265
SelectPrevAction
void SelectPrevAction()
Definition: actioninput.c:507
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
GetRunningActionMainitem
ItemBase GetRunningActionMainitem()
Definition: actionmanagerbase.c:98
m_TestedActionTarget
protected ActionTarget m_TestedActionTarget
Definition: actionmanagerbase.c:34
PlayerBase
Definition: playerbaseclient.c:1
map
map
Definition: controlsxboxnew.c:3
GetSelectableActions
TSelectableActionInfoArray GetSelectableActions()
Definition: actionmanagerbase.c:193
ActionConstructor
Definition: actionconstructor.c:1
LocalInterrupt
protected void LocalInterrupt()
Definition: actionmanagerbase.c:254
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
OnSyncJuncture
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
Definition: actionmanagerbase.c:130
OnInputUserDataProcess
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
Definition: actionmanagerbase.c:282
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
GetAction
override ActionBase GetAction()
Definition: actioninput.c:482
OnSingleUse
void OnSingleUse()
m_Interrupted
bool m_Interrupted
Definition: actionmanagerbase.c:49
DayZPlayerSyncJunctures
Definition: dayzplayersyncjunctures.c:4
m_PendingActionAcknowledgmentID
protected int m_PendingActionAcknowledgmentID
Definition: actionmanagerbase.c:58
ActionPossibilityCheck
bool ActionPossibilityCheck(int pCurrentCommandID)
Definition: actionmanagerbase.c:218
EnableActions
void EnableActions(bool enable)
Definition: actionmanagerbase.c:106
Get
array< ref PlayerStatBase > Get()
Definition: playerstatspco.c:103
FindActionTarget
ActionTarget FindActionTarget()
m_PrimaryActionItem
protected ItemBase m_PrimaryActionItem
Definition: actionmanagerbase.c:39
UA_AM_REJECTED
const int UA_AM_REJECTED
Definition: constants.c:448
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition: isboxcollidinggeometryproxyclasses.c:27
OnContinuousStart
void OnContinuousStart()
IsSelectableActionsChanged
bool IsSelectableActionsChanged()
Definition: actionmanagerbase.c:212
ActionBase
void ActionBase()
Definition: actionbase.c:73
m_SelectableActionsHasChanged
bool m_SelectableActionsHasChanged
Definition: actionmanagerbase.c:48
SelectPrevActionCategory
void SelectPrevActionCategory()
m_PrimaryActionTarget
protected ActionTarget m_PrimaryActionTarget
Definition: actionmanagerbase.c:38
Debug
Definition: debug.c:13
m_ActionInputWantEnd
protected bool m_ActionInputWantEnd
Definition: actionmanagerbase.c:53
EndActionInput
void EndActionInput()
GetSelectedActionIndex
int GetSelectedActionIndex()
Definition: actionmanagerbase.c:198
GetSingleUseAction
ActionBase GetSingleUseAction()
Definition: actionmanagerbase.c:188
StartDeliveredAction
void StartDeliveredAction()
UA_AM_PENDING
const int UA_AM_PENDING
Definition: constants.c:446
UA_NONE
const int UA_NONE
Definition: constants.c:432
OnInteractAction
void OnInteractAction()
m_SecondaryActionItem
protected ItemBase m_SecondaryActionItem
Definition: actionmanagerbase.c:42
m_SecondaryActionEnabled
bool m_SecondaryActionEnabled
Definition: actionmanagerbase.c:44
m_ActionsAvaibale
protected bool m_ActionsAvaibale
Definition: actionmanagerbase.c:55
GetActionState
int GetActionState(ActionBase action)
Definition: actionmanagerbase.c:237
Count
@ Count
Definition: randomgeneratorsyncmanager.c:7
SelectFirstActionCategory
void SelectFirstActionCategory()
m_PrimaryActionEnabled
bool m_PrimaryActionEnabled
Definition: actionmanagerbase.c:43
Interrupt
void Interrupt()