DayZ 1.24
Loading...
Searching...
No Matches
StateBase.c
Go to the documentation of this file.
2{
3 const float MAX_TIME_ACTIVE_SAVEGUARD = 20;
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
27
29
31 {
32 }
33
35 {
36
37 }
38
40 {
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
81 {
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
116 {
117 for (int i = 0; i < m_PersistentParams.Count(); i++)
118 params.Insert(m_PersistentParams.Get(i));
119 }
120
122 {
123 if (!GetGame().IsServer() && !GetGame().IsMultiplayer()) return;
124
125 m_PersistentParams.Insert(object);
126 }
127
129 {
130 return m_IsPersistent;
131 }
132
134 {
135 if (m_SymptomType == SymptomTypes.PRIMARY)
136 return true;
137 else return false;
138 }
139
141 {
142 return m_Player;
143 }
144
146 {
147 return m_Priority;
148 }
149
151 {
152
153 }
154
156 {
157 if (IsActivated()) Deactivate();
159 }
160
161 void Activate()
162 {
163 m_IsActivated = true;
164 if (GetGame() && GetGame().IsServer())
165 {
167 if (GetGame().IsMultiplayer())
168 {
169 if (IsSyncToClient())
171#ifdef DIAG_DEVELOPER
172 GetManager().SendServerDebugToClient();
173#endif
174 }
175 }
176 if (!GetGame().IsDedicatedServer())
178 }
179
181 {
182 if (!GetGame()) return;
183 m_IsActivated = false;
184 if (GetGame().IsServer())
185 {
187 if (GetGame().IsMultiplayer() && IsSyncToClient())
189 }
190 if (!GetGame().IsDedicatedServer())
192
193 }
194
196 {
197 return m_IsActivated;
198 }
199
200
201 void Update(float deltatime)
202 {
203 if (GetGame().IsServer())
204 {
207 {
211 }
212 }
213 if (GetGame().IsClient())
215 if (GetGame().IsServer() && !GetGame().IsMultiplayer() && !GetGame().IsMissionMainMenu())
217 CheckDestroy();
218 }
219
225
231
233 {
234 GetPlayer().RequestSoundEvent(id);
235 m_PlayedSound = true;
236 }
237
239 {
240 if (!GetPlayer()) return;
241
244 GetGame().RPCSingleParam(GetPlayer(), ERPCs.RPC_PLAYER_SYMPTOM_ON, CachedObjectsParams.PARAM2_INT_INT, true, GetPlayer().GetIdentity());
245 }
246
248 {
249 if (!GetPlayer()) return;
252 GetGame().RPCSingleParam(GetPlayer(), ERPCs.RPC_PLAYER_SYMPTOM_OFF, CachedObjectsParams.PARAM2_INT_INT, true, GetPlayer().GetIdentity());
253 }
254
256 {
257 if (GetGame().IsServer())
258 {
261 }
262 }
263
273
275 {
276 return null;
277 }
278
279
281 {
282 m_DestroyRequested = true;
283 //if(!IsActivated() ) Destroy();
284 }
285
286 void Destroy()
287 {
288 if (!m_IsTemplate)
289 OnDestructed();
290 }
291
294 {
295 //Print("*********** OnAnimationFinish ************");
298 }
299
305
307 {
309 }
310
311 protected void OnAnimationFinish();
312 protected void OnAnimationStart();
313 protected void OnAnimationPlayFailed();
314
315
317 void OnInit();
318
321 bool CanActivate() {return true;} //server only
330}
ERPCs
Definition ERPCs.c:2
SymptomTypes
static ref Param2< int, int > PARAM2_INT_INT
static void SendPlayerSymptomFB(DayZPlayer pPlayer, DayZPlayerConstants anim_id, int state_type, int stance_mask, float duration)
static void SendPlayerSymptomADD(DayZPlayer pPlayer, int type, int state_type)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
bool m_IsPersistent
Definition StateBase.c:19
SymptomCB m_AnimCallback
Definition StateBase.c:26
bool IsPersistent()
Definition StateBase.c:128
void OnAnimationStart()
bool OnConstructed(SymptomManager manager)
Definition StateBase.c:150
bool m_DestroyRequested
Definition StateBase.c:17
void AnimationFinish()
gets called upon animation Symptom exit
Definition StateBase.c:293
bool m_IsTemplate
Definition StateBase.c:11
float GetDuration()
Definition StateBase.c:85
bool m_SyncToClient
Definition StateBase.c:21
void OnGetActivatedServer(PlayerBase player)
gets called once on an Symptom which is being activated
bool CanActivate()
Definition StateBase.c:321
int GetPriority()
Definition StateBase.c:145
bool IsPrimary()
Definition StateBase.c:133
void ~SymptomBase()
Definition 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)
Definition StateBase.c:39
void SyncToClientDeactivated(int SYMPTOM_id, int uid)
Definition StateBase.c:247
bool IsSyncToClient()
Definition StateBase.c:110
PlayerBase GetPlayer()
Definition StateBase.c:140
const float MAX_TIME_ACTIVE_SAVEGUARD
Definition StateBase.c:3
void OnAnimationPlayFailed()
float m_ServerUpdateInterval
Definition StateBase.c:9
string GetName()
Definition StateBase.c:90
void OnAnimationFinish()
void CheckDestroy()
Definition StateBase.c:264
float m_ServerUpdateDelta
Definition StateBase.c:10
int m_Priority
Definition StateBase.c:4
bool m_IsClientOnly
Definition StateBase.c:15
void PlayAnimationADD(int type)
Definition StateBase.c:226
void OnGetDeactivatedClient(PlayerBase player)
void Activate()
Definition StateBase.c:161
void OnDestructed()
Definition StateBase.c:155
void PlaySound(EPlayerSoundEventID id)
Definition StateBase.c:232
float m_Duration
Definition StateBase.c:22
int GetMaxCount()
Definition StateBase.c:48
bool m_DestroyOnAnimFinish
Definition StateBase.c:16
void SetDuration(float duration)
Definition StateBase.c:80
void Destroy()
Definition StateBase.c:286
void SyncToClientActivated(int SYMPTOM_id, int uid)
Definition StateBase.c:238
int m_SymptomType
Definition StateBase.c:18
bool m_IsActivated
Definition StateBase.c:7
void Update(float deltatime)
Definition StateBase.c:201
void OnUpdateClient(PlayerBase player, float deltatime)
gets called every frame
bool IsActivated()
Definition StateBase.c:195
void OnUpdateServer(PlayerBase player, float deltatime)
gets called every frame
SymptomManager GetManager()
Definition StateBase.c:95
SoundOnVehicle m_SoundObject
Definition StateBase.c:5
bool CanBeInterupted()
Definition StateBase.c:64
SymptomManager m_Manager
Definition StateBase.c:20
bool IsClientOnly()
Definition StateBase.c:74
SmptAnimMetaBase SpawnAnimMetaObject()
Definition StateBase.c:274
void MakeParamObjectPersistent(Param object)
Definition StateBase.c:121
void SymptomBase()
Definition StateBase.c:30
void RequestDestroy()
Definition StateBase.c:280
bool m_AnimPlayRequested
Definition StateBase.c:23
void GetPersistentParams(array< Param > params)
Definition StateBase.c:115
void PlayAnimationFB(int animation, int stance_mask, float running_time=-1)
Definition StateBase.c:220
void SetParam(Param p)
Definition StateBase.c:105
int GetUID()
Definition StateBase.c:53
void AnimationPlayFailed()
Definition StateBase.c:300
void CheckSoundFinished()
Definition StateBase.c:255
void OnOwnerKilled()
Definition StateBase.c:58
void OnGetDeactivatedServer(PlayerBase player)
only gets called once on an active Symptom that is being deactivated
int m_MaxCount
Definition StateBase.c:24
ref array< Param > m_PersistentParams
Definition StateBase.c:28
int GetType()
Definition StateBase.c:100
float m_ActivatedTime
Definition StateBase.c:12
bool m_PlayedSound
Definition StateBase.c:6
void AnimationStart()
Definition StateBase.c:306
PlayerBase m_Player
Definition StateBase.c:8
void Deactivate()
Definition StateBase.c:180
void OnSymptomExit(SymptomBase Symptom, int uid)
proto native CGame GetGame()