DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionContinuousBase.c
См. документацию.
2{
3 bool m_inLoop = false;
4 bool m_callLoopEnd = false;
5
7 {
8 if ( !m_ActionData )
9 {
11 }
13 {
15 if ( m_ActionData.m_State == UA_INITIALIZE )
16 {
19 m_callLoopEnd = true;
20 }
21
22 if (!m_Interrupted)
23 actionS.Do(m_ActionData, m_ActionData.m_State);
24 }
25 else if (m_callLoopEnd == true)
26 {
29 m_callLoopEnd = false;
30 }
32 }
33
34 void SetInLoop(bool value)
35 {
36 m_inLoop = value;
37 }
38
39 override void InitActionComponent()
40 {
41 m_Interrupted = false;
42 m_Canceled = false;
43 m_inLoop = false;
44
46 if ( m_ActionData.m_ActionComponent )
47 {
48 m_ActionData.m_ActionComponent.Init(m_ActionData);
49 }
51 RegisterAnimationEvent("ActionExecStart", UA_IN_START);
52 RegisterAnimationEvent("ActionExecEnd", UA_IN_END);
55 m_SoundObject = m_ActionData.m_Action.PlayActionSound(m_ActionData.m_Player);
56 }
57
58 //TODO: consider this for general use
59 /*override void EndActionComponent()
60 {
61 ActionContinuousBase action = ActionContinuousBase.Cast(m_ActionData.m_Action);
62
63 if (m_ActionData.m_State != UA_FINISHED)
64 m_Canceled = true;
65
66 if (m_ActionData.m_State == UA_FINISHED || m_ActionData.m_State == UA_CANCEL)
67 {
68 if (action.UseAlternativeInterrupt(m_ActionData))
69 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
70 else
71 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
72 }
73 else
74 {
75 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
76 }
77 }*/
78
79 override void EndActionComponent()
80 {
81 // TODO for second type animation SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
82 if ( m_ActionData.m_State == UA_FINISHED )
83 {
84 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
85 }
86 else if (m_ActionData.m_State == UA_CANCEL )
87 {
89 if(action.HasAlternativeInterrupt())
90 {
91 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
92 }
93 else
94 {
95 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
96 }
97 m_Canceled = true;
98 return;
99 //Cancel();
100 }
101 else
102 {
103 m_Canceled = true;
104 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
105 return;
106 }
107 m_ActionData.m_State = UA_FINISHED;
108 }
109
111 {
112 if ( m_ActionData.m_ActionComponent )
113 {
114 m_ActionData.m_State = m_ActionData.m_ActionComponent.Cancel(m_ActionData);
115 }
116 //EndActionComponent(); //already handled in 'AnimatedActionBase::Do' on cancel
117 }
118};
119
121{
122 PluginAdminLog m_AdminLog;
123
125 {
127 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EAT;
128
129 if( GetGame() && GetGame().IsServer() )
130 {
131 m_AdminLog = PluginAdminLog.Cast( GetPlugin(PluginAdminLog) );
132 }
133 }
134
135 override void OnEndInput( ActionData action_data )
136 {
137 ActionContinuousBaseCB callback;
138 if( Class.CastTo(callback, action_data.m_Callback) )
139 {
140 if ( callback.GetState() != callback.STATE_LOOP_END && callback.GetState() != callback.STATE_LOOP_END2 )
141 {
142 callback.UserEndsAction();
143 }
144 }
145 }
146
148 {
149 return false;
150 }
151
153 {
154 return false;
155 }
156
157 // lock default camera while performing the action
159 {
160 return true;
161 }
162
163 // camera up/down angle when performing a fullbody action
164 // values beetwen 0 and -90 (looking at ground) / 0 and 90 (looking above)
166 {
167 Vector2 udAngle = new Vector2(-70, 45);
168 return udAngle;
169 }
170
171 // camera (heading) left/right angle when performing a fullbody action
172 // values beetwen 0 and -180 (left restriction) / 0 and 180 (right restriction)
174 {
175 Vector2 lrAngle = new Vector2(-70, 70);
176 return lrAngle;
177 }
178
179 override typename GetInputType()
180 {
182 }
183
184 override int GetActionCategory()
185 {
186 return AC_CONTINUOUS;
187 }
188
189 override void OnAnimationEvent(ActionData action_data)
190 {
191 super.OnAnimationEvent(action_data);
192 ActionContinuousBaseCB callback;
193 if (Class.CastTo(callback, action_data.m_Callback))
194 {
195 if (action_data.m_DelayedAnimationEventID == UA_IN_START)
196 {
197 OnStartAnimationLoop(action_data);
198 callback.SetInLoop(true);
199 }
200 else if (action_data.m_DelayedAnimationEventID == UA_IN_END)
201 {
202 OnEndAnimationLoop(action_data);
203 callback.SetInLoop(false);
204 }
205 }
206 }
207
209 {
211 {
212 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnStartAnimationLoop", action_data.m_Player.ToString() );
213 }
214
215 if (GetGame().IsServer())
216 {
217 OnStartAnimationLoopServer(action_data);
218 }
219 else
220 {
221 OnStartAnimationLoopClient(action_data);
222 }
223 action_data.m_WasExecuted = false;
224 }
225
226 void OnEndAnimationLoop( ActionData action_data )
227 {
229 {
230 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnEndAnimationLoop", action_data.m_Player.ToString() );
231 }
232 if (GetGame().IsServer())
233 {
234 OnEndAnimationLoopServer(action_data);
235 }
236 else
237 {
238 OnEndAnimationLoopClient(action_data);
239 }
240 action_data.m_WasExecuted = false;
241 }
242
243 void OnFinishProgress( ActionData action_data )
244 {
246 {
247 Debug.ActionLog("Time stamp: " + action_data.m_Player.GetSimulationTimeStamp(), this.ToString() , "n/a", "OnFinishProgress", action_data.m_Player.ToString() );
248 }
249 if (GetGame().IsServer())
250 {
251 OnFinishProgressServer(action_data);
252
253 if ( m_AdminLog )
254 {
255 m_AdminLog.OnContinouousAction( action_data );
256 }
257 }
258 else
259 {
260 OnFinishProgressClient(action_data);
261 }
262 action_data.m_WasExecuted = false;
263 }
264
265
266 protected void OnStartAnimationLoopServer( ActionData action_data ) //method called on start main animation loop (after in animation part )
267 {
268 action_data.m_WasActionStarted = true;
269 }
270
271 protected void OnStartAnimationLoopClient( ActionData action_data ) //method called on start main animation loop (after in animation part )
272 {
273 action_data.m_WasActionStarted = true;
274 }
275
276 protected void OnEndAnimationLoopServer( ActionData action_data ) //method called on finish main animation loop (before out animation part )
277 {
278 }
279 protected void OnEndAnimationLoopClient( ActionData action_data ) //method called on finish main animation loop (before out animation part )
280 {
281 }
282
283 protected void OnFinishProgressServer( ActionData action_data )
284 {
285 }
286
287 protected void OnFinishProgressClient( ActionData action_data )
288 {
289 }
290};
const int AC_CONTINUOUS
Определения _constants.c:3
ActionBase ActionData
Определения ActionBase.c:30
void ContinuousDefaultActionInput(PlayerBase player)
Определения ActionInput.c:607
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
bool m_Interrupted
Определения AnimatedActionBase.c:6
bool m_Canceled
Определения AnimatedActionBase.c:5
void CreateActionComponent()
Определения AnimatedActionBase.c:61
void SetCommand(int command_uid)
Определения AnimatedActionBase.c:54
SoundOnVehicle m_SoundObject
Определения AnimatedActionBase.c:4
void ActionBaseCB()
Определения AnimatedActionBase.c:9
ActionData m_ActionData
Определения AnimatedActionBase.c:3
Vector2 GetCameraLRAngle()
Определения ActionContinuousBase.c:173
override GetInputType()
Определения ActionContinuousBase.c:179
void OnEndAnimationLoop(ActionData action_data)
Определения ActionContinuousBase.c:226
bool UseAlternativeInterrupt(ActionData action_data)
Определения ActionContinuousBase.c:152
void OnFinishProgressClient(ActionData action_data)
Определения ActionContinuousBase.c:287
void OnEndAnimationLoopClient(ActionData action_data)
Определения ActionContinuousBase.c:279
bool HasAlternativeInterrupt()
Определения ActionContinuousBase.c:147
void OnStartAnimationLoopServer(ActionData action_data)
Определения ActionContinuousBase.c:266
override void OnEndInput(ActionData action_data)
Определения ActionContinuousBase.c:135
override int GetActionCategory()
Определения ActionContinuousBase.c:184
Vector2 GetCameraUDAngle()
Определения ActionContinuousBase.c:165
void OnFinishProgress(ActionData action_data)
Определения ActionContinuousBase.c:243
void OnStartAnimationLoop(ActionData action_data)
Определения ActionContinuousBase.c:208
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
void OnFinishProgressServer(ActionData action_data)
Определения ActionContinuousBase.c:283
bool IsCameraLockOnPerform()
Определения ActionContinuousBase.c:158
void OnStartAnimationLoopClient(ActionData action_data)
Определения ActionContinuousBase.c:271
override void OnAnimationEvent(ActionData action_data)
Определения ActionContinuousBase.c:189
PluginAdminLog m_AdminLog
Определения ActionContinuousBase.c:122
void OnEndAnimationLoopServer(ActionData action_data)
Определения ActionContinuousBase.c:276
bool CancelCondition()
Определения ActionContinuousBase.c:6
override void EndActionComponent()
Определения ActionContinuousBase.c:79
bool m_callLoopEnd
Определения ActionContinuousBase.c:4
void SetInLoop(bool value)
Определения ActionContinuousBase.c:34
void UserEndsAction()
Определения ActionContinuousBase.c:110
override void InitActionComponent()
Определения ActionContinuousBase.c:39
void Do(ActionData action_data, int state)
Определения AnimatedActionBase.c:382
int m_CommandUID
Определения AnimatedActionBase.c:143
void AnimatedActionBase()
Определения AnimatedActionBase.c:151
Super root of all classes in Enforce script.
Определения EnScript.c:11
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:127
Определения Debug.c:2
static bool IsActionLogEnable()
Определения Debug.c:638
Определения Debug.c:594
Определения Vector2.c:2
DayZPlayerConstants
defined in C++
Определения 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
Определения constants.c:477
const int UA_FINISHED
Определения constants.c:464
const int UA_INITIALIZE
Определения constants.c:472
const int UA_ANIM_EVENT
Определения constants.c:471
const int UA_IN_END
Определения constants.c:478
const int UA_PROCESSING
Определения constants.c:462
const int UA_CANCEL
Определения constants.c:465
proto native void EnableCancelCondition(bool pEnable)
static const int STATE_LOOP_LOOP
Определения human.c:353
proto native int GetState()
returns one of STATE_...
Определения StaminaHandler.c:31
static const int STATE_LOOP_LOOP2
Определения human.c:356
proto native bool DefaultCancelCondition()
system implemented cancel condition (now raise or sprint cancels action)