DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
StateBase.c
См. документацию.
2{
3 const float MAX_TIME_ACTIVE_SAVEGUARD = 20;
5 SoundOnVehicle m_SoundObject;
11 bool m_IsTemplate = true;
13 int m_ID;//ID for the type of Symptom
14 int m_UID;//unique ID
17 bool m_DestroyRequested = false;
18 int m_SymptomType = -1;
19 bool m_IsPersistent = false;
21 bool m_SyncToClient = false;
24 int m_MaxCount = -1;//how many symptoms of this type can be queued up at the same time, '-1' for unlimited
25
26 SymptomCB m_AnimCallback;
27
29
31 {
32 }
33
35 {
36
37 }
38
39 void Init(SymptomManager manager, PlayerBase player, int uid)
40 {
41 m_Manager = manager;
42 m_Player = player;
43 m_UID = uid;
44 m_IsTemplate = false;
45 OnInit();
46 }
47
49 {
50 return m_MaxCount;
51 }
52
53 int GetUID()
54 {
55 return m_UID;
56 }
57
59 {
60
61
62 }
63
65 {
67 {
68 //Print("--------- preventing interrupt ---------");
69 return false;
70 }
71 return true;
72 }
73
75 {
76 return m_IsClientOnly;
77 }
78
79
80 void SetDuration(float duration)
81 {
82 m_Duration = duration;
83 }
84
86 {
87 return m_Duration;
88 }
89
90 string GetName()
91 {
92 return this.ClassName();
93 }
94
96 {
97 return m_Manager;
98 }
99
101 {
102 return m_ID;
103 }
104
106 {
107
108 }
109
111 {
112 return m_SyncToClient;
113 }
114
117 {
118 return false;
119 }
120
122 {
123 for (int i = 0; i < m_PersistentParams.Count(); i++)
124 {
125 params.Insert(m_PersistentParams.Get(i));
126 }
127 }
128
130 {
131 if ( !GetGame().IsServer() && !GetGame().IsMultiplayer() ) return;
132
133 m_PersistentParams.Insert(object);
134 }
135
137 {
138 return m_IsPersistent;
139 }
140
142 {
143 if ( m_SymptomType == SymptomTypes.PRIMARY)
144 return true;
145 else return false;
146 }
147
148 // override this if you want the symptom to be played also while the player is unconscious
150 {
151 return false;
152 }
153
155 {
156 return m_Player;
157 }
158
160 {
161 return m_Priority;
162 }
163
165 {
166
167 }
168
170 {
171 if ( IsActivated() ) Deactivate();
172 if ( GetManager() ) m_Manager.OnSymptomExit(this, m_UID);
173 }
174
175 void Activate()
176 {
177 m_IsActivated = true;
178 if ( GetGame() && GetGame().IsServer() )
179 {
181 if ( GetGame().IsMultiplayer() )
182 {
183 if ( IsSyncToClient() )
185 #ifdef DIAG_DEVELOPER
186 GetManager().SendServerDebugToClient();
187 #endif
188 }
189 }
190 if ( !GetGame().IsDedicatedServer() )
191 {
193 }
194 }
195
197 {
198 if ( !GetGame() ) return;
199 m_IsActivated = false;
200 if ( GetGame().IsServer() )
201 {
203 if ( GetGame().IsMultiplayer() && IsSyncToClient() )
204 {
206 }
207 }
208 if ( !GetGame().IsDedicatedServer() )
209 {
211 }
212
213 }
214
216 {
217 return m_IsActivated;
218 }
219
220
221
222 void Update(float deltatime)
223 {
224 if ( GetGame().IsServer() )
225 {
226 m_ServerUpdateDelta += deltatime;
228 {
232 }
233 }
234 if ( GetGame().IsClient() )
235 {
236 OnUpdateClient(m_Player, deltatime);
237 }
238 if ( GetGame().IsServer() && !GetGame().IsMultiplayer() && !GetGame().IsMissionMainMenu() )
239 {
240 OnUpdateClient(m_Player, deltatime);
241 }
242 CheckDestroy();
243 }
244
245 void PlayAnimationFB(int animation, int stance_mask, float running_time = -1)
246 {
247 DayZPlayerSyncJunctures.SendPlayerSymptomFB(m_Player, animation, GetType() , stance_mask, running_time );
248 m_AnimPlayRequested = true;
249 }
250
256
258 {
259 GetPlayer().RequestSoundEvent(id);
260 m_PlayedSound = true;
261 }
262
263 void SyncToClientActivated( int SYMPTOM_id, int uid )
264 {
265 if ( !GetPlayer() ) return;
266
267 CachedObjectsParams.PARAM2_INT_INT.param1 = SYMPTOM_id;
269 GetGame().RPCSingleParam(GetPlayer(), ERPCs.RPC_PLAYER_SYMPTOM_ON, CachedObjectsParams.PARAM2_INT_INT,true,GetPlayer().GetIdentity() );
270 }
271
272 void SyncToClientDeactivated( int SYMPTOM_id, int uid )
273 {
274 if ( !GetPlayer() ) return;
275 CachedObjectsParams.PARAM2_INT_INT.param1 = SYMPTOM_id;
277 GetGame().RPCSingleParam(GetPlayer(), ERPCs.RPC_PLAYER_SYMPTOM_OFF, CachedObjectsParams.PARAM2_INT_INT,true,GetPlayer().GetIdentity() );
278 }
279
281 {
282 if (GetGame().IsServer())
283 {
286 }
287 }
288
290 {
293 {
295 }
296
298 Destroy();
299 }
300
302 {
303 return null;
304 }
305
306
308 {
309 m_DestroyRequested = true;
310 //if(!IsActivated() ) Destroy();
311 }
312
313 void Destroy()
314 {
315 if (!m_IsTemplate)
316 OnDestructed();
317 }
318
321 {
322 //Print("*********** OnAnimationFinish ************");
325 }
326
332
334 {
336 }
337
338 protected void OnAnimationFinish();
339 protected void OnAnimationStart();
340 protected void OnAnimationPlayFailed();
341
342
344 void OnInit();
345
347 void OnUpdateServer(PlayerBase player, float deltatime);
348 bool CanActivate(){return true;}//server only
350 void OnUpdateClient(PlayerBase player, float deltatime);
357}
ERPCs
Определения ERPCs.c:2
EPlayerSoundEventID
Определения PlayerSoundEventHandler.c:3
SymptomTypes
Определения StateManager.c:32
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
static ref Param2< int, int > PARAM2_INT_INT
Определения UtilityClasses.c:16
static void SendPlayerSymptomFB(DayZPlayer pPlayer, DayZPlayerConstants anim_id, int state_type, int stance_mask, float duration)
Определения DayZPlayerSyncJunctures.c:234
static void SendPlayerSymptomADD(DayZPlayer pPlayer, int type, int state_type)
Определения DayZPlayerSyncJunctures.c:211
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
Определения SmptAnimMeta.c:83
bool m_IsPersistent
Определения StateBase.c:19
bool AllowInUnconscious()
Определения StateBase.c:149
SymptomCB m_AnimCallback
Определения StateBase.c:26
bool IsPersistent()
Определения StateBase.c:136
void OnAnimationStart()
bool OnConstructed(SymptomManager manager)
Определения StateBase.c:164
bool m_DestroyRequested
Определения StateBase.c:17
void AnimationFinish()
gets called upon animation Symptom exit
Определения StateBase.c:320
bool IsSyncToRemotes()
This symptom is synchronized to remotes in a form id within symptom manager.
Определения StateBase.c:116
bool m_IsTemplate
Определения StateBase.c:11
float GetDuration()
Определения StateBase.c:85
bool m_SyncToClient
Определения StateBase.c:21
void OnGetActivatedServer(PlayerBase player)
gets called once on an Symptom which is being activated
bool CanActivate()
Определения StateBase.c:348
int GetPriority()
Определения StateBase.c:159
bool IsPrimary()
Определения StateBase.c:141
void ~SymptomBase()
Определения StateBase.c:34
void OnGetActivatedClient(PlayerBase player)
void OnInit()
this is just for the Symptom parameters set-up and is called even if the Symptom doesn't execute,...
void Init(SymptomManager manager, PlayerBase player, int uid)
Определения StateBase.c:39
void SyncToClientDeactivated(int SYMPTOM_id, int uid)
Определения StateBase.c:272
bool IsSyncToClient()
Определения StateBase.c:110
PlayerBase GetPlayer()
Определения StateBase.c:154
const float MAX_TIME_ACTIVE_SAVEGUARD
Определения StateBase.c:3
void OnAnimationPlayFailed()
float m_ServerUpdateInterval
Определения StateBase.c:9
string GetName()
Определения StateBase.c:90
void OnAnimationFinish()
void CheckDestroy()
Определения StateBase.c:289
float m_ServerUpdateDelta
Определения StateBase.c:10
int m_Priority
Определения StateBase.c:4
bool m_IsClientOnly
Определения StateBase.c:15
void PlayAnimationADD(int type)
Определения StateBase.c:251
void OnGetDeactivatedClient(PlayerBase player)
void Activate()
Определения StateBase.c:175
void OnDestructed()
Определения StateBase.c:169
void PlaySound(EPlayerSoundEventID id)
Определения StateBase.c:257
float m_Duration
Определения StateBase.c:22
int GetMaxCount()
Определения StateBase.c:48
bool m_DestroyOnAnimFinish
Определения StateBase.c:16
void SetDuration(float duration)
Определения StateBase.c:80
void Destroy()
Определения StateBase.c:313
void SyncToClientActivated(int SYMPTOM_id, int uid)
Определения StateBase.c:263
int m_ID
Определения StateBase.c:13
int m_SymptomType
Определения StateBase.c:18
bool m_IsActivated
Определения StateBase.c:7
void Update(float deltatime)
Определения StateBase.c:222
void OnUpdateClient(PlayerBase player, float deltatime)
gets called every frame
bool IsActivated()
Определения StateBase.c:215
void OnUpdateServer(PlayerBase player, float deltatime)
gets called every frame
SymptomManager GetManager()
Определения StateBase.c:95
SoundOnVehicle m_SoundObject
Определения StateBase.c:5
bool CanBeInterupted()
Определения StateBase.c:64
SymptomManager m_Manager
Определения StateBase.c:20
bool IsClientOnly()
Определения StateBase.c:74
int m_UID
Определения StateBase.c:14
SmptAnimMetaBase SpawnAnimMetaObject()
Определения StateBase.c:301
void MakeParamObjectPersistent(Param object)
Определения StateBase.c:129
void SymptomBase()
Определения StateBase.c:30
void RequestDestroy()
Определения StateBase.c:307
bool m_AnimPlayRequested
Определения StateBase.c:23
void GetPersistentParams(array< Param > params)
Определения StateBase.c:121
void PlayAnimationFB(int animation, int stance_mask, float running_time=-1)
Определения StateBase.c:245
void SetParam(Param p)
Определения StateBase.c:105
int GetUID()
Определения StateBase.c:53
void AnimationPlayFailed()
Определения StateBase.c:327
void CheckSoundFinished()
Определения StateBase.c:280
void OnOwnerKilled()
Определения StateBase.c:58
void OnGetDeactivatedServer(PlayerBase player)
only gets called once on an active Symptom that is being deactivated
int m_MaxCount
Определения StateBase.c:24
ref array< Param > m_PersistentParams
Определения StateBase.c:28
int GetType()
Определения StateBase.c:100
float m_ActivatedTime
Определения StateBase.c:12
bool m_PlayedSound
Определения StateBase.c:6
void AnimationStart()
Определения StateBase.c:333
PlayerBase m_Player
Определения StateBase.c:8
void Deactivate()
Определения StateBase.c:196
Определения StateManager.c:48
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()