DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionContinuousBase.c
Go to the documentation of this file.
2{
3 bool m_inLoop = false;
4 bool m_callLoopEnd = false;
5
7 {
8 if ( !m_ActionData )
9 {
11 }
13 {
16 {
19 m_callLoopEnd = true;
20 }
21
22 if (!m_Interrupted)
24 }
25 else if (m_callLoopEnd == true)
26 {
29 m_callLoopEnd = false;
30 }
32 }
33
34
35 override void OnAnimationEvent(int pEventID)
36 {
38 {
40#ifdef DEVELOPER
41 //Print("ActionInteractBase.c | OnAnimationEvent | OnAnimationEvent called");
42#endif
43 if ( !m_Interrupted && pEventID == UA_IN_START )
44 {
45 m_inLoop = true;
46 //ActionContinuousBase.Cast(action).OnStartLoop( m_ActionData );
47 }
48 else if ( !m_Interrupted && pEventID == UA_IN_END )
49 {
50
51 m_inLoop = false;
52 //ActionContinuousBase.Cast(action).OnCompleteLoop( m_ActionData );
53 }
54 else if ( !m_Interrupted && pEventID == UA_ANIM_EVENT )
55 {
57 //action.OnCompleteLoop( m_ActionData );
58 }
59 }
60 else
61 {
62 //Debug.LogError("Call OnAnimationEvent ")
63 }
64 }
65
66 override void InitActionComponent()
67 {
68 m_Interrupted = false;
69 m_Canceled = false;
70 m_inLoop = false;
71
74 {
76 }
78 RegisterAnimationEvent("ActionExecStart", UA_IN_START);
79 RegisterAnimationEvent("ActionExecEnd", UA_IN_END);
83 }
84
85 override void EndActionComponent()
86 {
87 // TODO for second type animation SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
89 {
90 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
91 }
92 else if (m_ActionData.m_State == UA_CANCEL )
93 {
95 if(action.HasAlternativeInterrupt())
96 {
97 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
98 }
99 else
100 {
101 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
102 }
103 m_Canceled = true;
104 return;
105 //Cancel();
106 }
107 else
108 {
109 m_Canceled = true;
110 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
111 return;
112 }
114 }
115
117 {
119 {
121 }
123 }
124};
125
127{
128 PluginAdminLog m_AdminLog;
129
131 {
133 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EAT;
134
135 if( GetGame() && GetGame().IsServer() )
136 {
137 m_AdminLog = PluginAdminLog.Cast( GetPlugin(PluginAdminLog) );
138 }
139 }
140
141 override void OnEndInput( ActionData action_data )
142 {
143 ActionContinuousBaseCB callback;
144 if( Class.CastTo(callback, action_data.m_Callback) )
145 {
146 if ( callback.GetState() != callback.STATE_LOOP_END && callback.GetState() != callback.STATE_LOOP_END2 )
147 {
148 callback.UserEndsAction();
149 }
150 }
151 }
152
154 {
155 return false;
156 }
157
158 override typename GetInputType()
159 {
161 }
162
163 override int GetActionCategory()
164 {
165 return AC_CONTINUOUS;
166 }
167
169 {
171 {
172 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnStartAnimationLoop", action_data.m_Player.ToString() );
173 }
174
175 if (GetGame().IsServer())
176 {
177 OnStartAnimationLoopServer(action_data);
178 }
179 else
180 {
181 OnStartAnimationLoopClient(action_data);
182 }
183 action_data.m_WasExecuted = false;
184 }
185
186 void OnEndAnimationLoop( ActionData action_data )
187 {
189 {
190 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnEndAnimationLoop", action_data.m_Player.ToString() );
191 }
192 if (GetGame().IsServer())
193 {
194 OnEndAnimationLoopServer(action_data);
195 }
196 else
197 {
198 OnEndAnimationLoopClient(action_data);
199 }
200 action_data.m_WasExecuted = false;
201 }
202
203 void OnFinishProgress( ActionData action_data )
204 {
206 {
207 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnFinishProgress", action_data.m_Player.ToString() );
208 }
209 if (GetGame().IsServer())
210 {
211 OnFinishProgressServer(action_data);
212
213 if ( m_AdminLog )
214 {
215 m_AdminLog.OnContinouousAction( action_data );
216 }
217 }
218 else
219 {
220 OnFinishProgressClient(action_data);
221 }
222 action_data.m_WasExecuted = false;
223 }
224
225
226 protected void OnStartAnimationLoopServer( ActionData action_data ) //method called on start main animation loop (after in animation part )
227 {
228 action_data.m_WasActionStarted = true;
229 }
230
231 protected void OnStartAnimationLoopClient( ActionData action_data ) //method called on start main animation loop (after in animation part )
232 {
233 action_data.m_WasActionStarted = true;
234 }
235
236 protected void OnEndAnimationLoopServer( ActionData action_data ) //method called on finish main animation loop (before out animation part )
237 {
238 }
239 protected void OnEndAnimationLoopClient( ActionData action_data ) //method called on finish main animation loop (before out animation part )
240 {
241 }
242
243 protected void OnFinishProgressServer( ActionData action_data )
244 {
245 }
246
247 protected void OnFinishProgressClient( ActionData action_data )
248 {
249 }
250};
const int AC_CONTINUOUS
Definition _constants.c:3
void ContinuousDefaultActionInput(PlayerBase player)
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
PluginBase GetPlugin(typename plugin_type)
void SetCommand(int command_uid)
protected bool m_Interrupted
protected bool m_Canceled
void CreateActionComponent()
protected ActionData m_ActionData
protected SoundOnVehicle m_SoundObject
override void OnAnimationEvent(int pEventID)
override void InitActionComponent()
override void EndActionComponent()
void OnStartAnimationLoop(ActionData action_data)
protected void OnStartAnimationLoopClient(ActionData action_data)
void OnEndAnimationLoop(ActionData action_data)
protected void OnFinishProgressClient(ActionData action_data)
protected void OnFinishProgressServer(ActionData action_data)
protected void OnEndAnimationLoopServer(ActionData action_data)
protected void OnEndAnimationLoopClient(ActionData action_data)
override void OnEndInput(ActionData action_data)
void OnFinishProgress(ActionData action_data)
protected void OnStartAnimationLoopServer(ActionData action_data)
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionBase m_Action
Definition ActionBase.c:27
bool m_WasActionStarted
Definition ActionBase.c:39
bool m_WasExecuted
Definition ActionBase.c:38
ActionBaseCB m_Callback
Definition ActionBase.c:29
ref CABase m_ActionComponent
Definition ActionBase.c:30
void OnAnimationEvent(ActionData action_data)
void Do(ActionData action_data, int state)
int Cancel(ActionData action_data)
Definition CABase.c:29
void Init(ActionData action_data)
Definition CABase.c:8
Super root of all classes in Enforce script.
Definition EnScript.c:11
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
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_IN_START
Definition constants.c:433
const int UA_FINISHED
Definition constants.c:420
const int UA_INITIALIZE
Definition constants.c:428
const int UA_ANIM_EVENT
Definition constants.c:427
const int UA_IN_END
Definition constants.c:434
const int UA_PROCESSING
Definition constants.c:418
const int UA_CANCEL
Definition constants.c:421
proto native void EnableCancelCondition(bool pEnable)
static const int STATE_LOOP_LOOP
Definition human.c:344
proto native int GetState()
returns one of STATE_...
static const int STATE_LOOP_LOOP2
Definition human.c:347
proto native bool DefaultCancelCondition()
system implemented cancel condition (now raise or sprint cancels action)