DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionManagerBase.c
Go to the documentation of this file.
1typedef Param3<int, int, string> TSelectableActionInfo;
2typedef Param4<int, int, string, int> TSelectableActionInfoWithColor;
3
4class TSelectableActionInfoArray extends array<ref TSelectableActionInfo>
5{
6 bool IsSameAs(TSelectableActionInfoArray other)
7 {
8 if (this.Count() != other.Count())
9 {
10 return false;
11 }
12
13 for (int i = 0; i < Count(); ++i)
14 {
15 TSelectableActionInfo ai1 = this.Get(i);
16 TSelectableActionInfo ai2 = other.Get(i);
17
18 if (ai1.param2 != ai2.param2)
19 {
20 return false;
21 }
22
23 if (ai1.param3 != ai2.param3)
24 {
25 return false;
26 }
27 }
28
29 return true;
30 }
31}
32
33class TSelectableActionInfoArrayEx extends array<ref Param> {}
34
36{
38
41
51 ref TSelectableActionInfoArray m_SelectableActions;
57 protected bool m_ActionWantEndRequest;
58 protected bool m_ActionInputWantEnd;
59 protected bool m_ActionsEnabled;
60 protected bool m_ActionsAvaibale;
61
62 //Pending actions waiting for acknowledgment
64
66
68 {
69 m_Player = player;
70 if (m_Player)
71 {
72 m_SelectableActions = new TSelectableActionInfoArray();
75
77
79 m_Interrupted = false;
80
82 if (!m_ActionsArray)
83 {
85 }
86
89 }
90
91 m_ActionsEnabled = true;
92 m_ActionsAvaibale = true;
93 }
94
96 {
99
100 return null;
101 }
102
104 {
107
108 return null;
109 }
110
111 void EnableActions(bool enable)
112 {
113 m_ActionsEnabled = enable;
114 }
115
116 void Update(int pCurrentCommandID)
117 {
119 {
120 if (m_Interrupted)
121 {
123 m_Interrupted = false;
124 }
126 {
128 }
129 }
130 }
131
132 void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
133 {
134 int AcknowledgmentID;
135 switch (pJunctureID)
136 {
138 pCtx.Read(AcknowledgmentID);
139 if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
141 break;
143 pCtx.Read(AcknowledgmentID);
144 if (m_CurrentActionData && AcknowledgmentID == m_PendingActionAcknowledgmentID)
146 break;
148 m_Interrupted = true;
149 break;
150 }
151 }
152
155
156 static ActionBase GetActionVariant(typename actionName)
157 {
159 {
160 ActionBase base_action = m_ActionNameActionMap.Get(actionName);
161 ActionBase new_action = ActionBase.Cast(actionName.Spawn());
162
163 new_action.CreateConditionComponents();
164 new_action.SetID(base_action.GetID());
165 new_action.SetInput(base_action.GetInput());
166
167 return new_action;
168 }
169 return null;
170 }
171
172 static ActionBase GetAction(typename actionName)
173 {
175 return m_ActionNameActionMap.Get(actionName);
176
177 return null;
178 }
179
180 static ActionBase GetAction(int actionID)
181 {
182 return m_ActionsArray.Get(actionID);
183 }
184
186 {
187 return m_PrimaryAction;
188 }
189
191 {
192 return m_SecondaryAction;
193 }
194
195 TSelectableActionInfoArray GetSelectableActions()
196 {
197 return m_SelectableActions;
198 }
199
201 {
203 }
204
209 void SelectNextAction();
210 void SelectPrevAction();
213
215 {
217 }
218
219 //------------------------------------------------------
220 bool ActionPossibilityCheck(int pCurrentCommandID)
221 {
222 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())
223 return false;
224
226 return false;
227
228 return (pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_VEHICLE);
229 }
230 //------------------------------------------------------
231 protected void SetActionContext(ActionTarget target, ItemBase item)
232 {
233 m_TestedActionTarget = target;
234 m_TestedActionItem = item;
235 }
236
237 //------------------------------------------------------
238
240 {
242 {
244 }
245 return UA_NONE;
246 }
247
248 //---------------------------------
249 // EVENTS
250 //---------------------------------
254 void Interrupt();
255
256 protected void LocalInterrupt()
257 {
260 }
261
262 void OnInteractAction(); //Interact
263 void OnInstantAction(typename user_action_type, Param data = null);
264
266 {
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 }
275 m_CurrentActionData = NULL;
276
277 m_Player.ResetActionEndInput();
278 }
279
281
282 bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
283 {
284 return false;
285 }
286
288 {
291
292 return 0.0;
293 }
294
296 {
299
300 return UA_NONE;
301 }
302
303 ActionReciveData GetReciveData()
304 {
305 return null;
306 }
307}
void ActionBase()
Definition ActionBase.c:73
override ActionBase GetAction()
override void SelectNextAction()
override void SelectPrevAction()
bool m_Interrupted
bool m_TertiaryActionEnabled
void SelectFirstActionCategory()
protected bool m_ActionInputWantEnd
bool IsSelectableActionsChanged()
ItemBase GetRunningActionMainitem()
GetSelectedActionCategory()
int GetActionState()
ActionBase GetContinuousAction()
protected bool m_ActionsAvaibale
bool m_SelectableActionsHasChanged
void OnActionEnd()
protected ActionTarget m_SecondaryActionTarget
void SelectNextActionCategory()
protected void SetActionContext(ActionTarget target, ItemBase item)
int GetSelectedActionIndex()
Param4< int, int, string, int > TSelectableActionInfoWithColor
protected bool m_ActionsEnabled
protected ItemBase m_PrimaryActionItem
void OnInstantAction(typename user_action_type, Param data=null)
static ActionBase GetActionVariant(typename actionName)
void OnContinuousCancel()
void EnableActions(bool enable)
ActionTarget FindActionTarget()
protected ActionTarget m_PrimaryActionTarget
int m_SelectedActionIndex
void SelectPrevActionCategory()
protected bool m_ActionWantEndRequest
ActionBase GetSingleUseAction()
Param3< int, int, string > TSelectableActionInfo
void OnSingleUse()
void OnContinuousStart()
bool m_SecondaryActionEnabled
TSelectableActionInfoArray GetSelectableActions()
void RequestEndAction()
bool ActionPossibilityCheck(int pCurrentCommandID)
void OnInteractAction()
ref TSelectableActionInfoArray m_SelectableActions
void EndActionInput()
static ref array< ref ActionBase > m_ActionsArray
float GetActionComponentProgress()
protected ActionBase m_SecondaryAction
ActionReciveData GetReciveData()
void ActionManagerBase(PlayerBase player)
void Interrupt()
void StartDeliveredAction()
protected ItemBase m_SecondaryActionItem
protected void LocalInterrupt()
protected ActionTarget m_TestedActionTarget
bool m_PrimaryActionEnabled
protected ItemBase m_TestedActionItem
protected ActionBase m_PrimaryAction
void OnJumpStart()
protected ref ActionData m_CurrentActionData
static ref map< typename, ActionBase > m_ActionNameActionMap
protected int m_PendingActionAcknowledgmentID
class ActionTargets ActionTarget
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
proto string ToString()
DayZPlayer m_Player
Definition Hand_Events.c:42
array< ref PlayerStatBase > Get()
bool ConstructActions(out array< ref ActionBase > actionsArray, out map< typename, ActionBase > actionNameActionMap)
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionBase m_Action
Definition ActionBase.c:27
DayZPlayerInventory GetDayZPlayerInventory()
WeaponManager GetWeaponManager()
DayZPlayerImplementThrowing GetThrowing()
bool IsThrowingAnimationPlaying()
Throwing animation after button release.
Definition Debug.c:14
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:138
static bool IsActionLogEnable()
Definition Debug.c:590
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
proto bool Read(void value_in)
bool IsSameAs(TSelectableActionInfoArray other)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
const int UA_AM_ACCEPTED
Definition constants.c:431
const int UA_AM_REJECTED
Definition constants.c:432
const int UA_NONE
Definition constants.c:416
const int UA_AM_PENDING
Definition constants.c:430
proto native volatile void Update()
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....