DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerSyncJunctures.c
Go to the documentation of this file.
1// *************************************************************************************
2// ! DayZPlayerSyncJunctures - sync junctures for dayz player - static functions
3// *************************************************************************************
5{
6 static const int SJ_DAMAGE_HIT = 0;
7 static const int SJ_INJURY = 1;
8 static const int SJ_ACTION_INTERRUPT = 2;
9 static const int SJ_PLAYER_STATES = 3;
10 static const int SJ_QUICKBAR_SET_SHORTCUT = 4;
11 static const int SJ_INVENTORY = 5;
12 static const int SJ_ACTION_ACK_ACCEPT = 6;
13 static const int SJ_ACTION_ACK_REJECT = 7;
14 static const int SJ_WEAPON_ACTION_ACK_ACCEPT = 8;
15 static const int SJ_WEAPON_ACTION_ACK_REJECT = 9;
16 static const int SJ_WEAPON_SET_JAMMING_CHANCE = 10;
17 static const int SJ_UNCONSCIOUSNESS = 11;
18 static const int SJ_DEATH = 12;
19 static const int SJ_PLAYER_FB_MODIFIER = 13;
20 static const int SJ_PLAYER_ADD_MODIFIER = 14;
21 static const int SJ_KURU_REQUEST = 15;
22 static const int SJ_GESTURE_REQUEST = 16;
23 static const int SJ_INVENTORY_REPAIR = 17;
24 static const int SJ_WEAPON_LIFT = 18;
25 static const int SJ_WEAPON_RAISE_COMPLETED = 19;
26 static const int SJ_DELETE_ITEM = 20;
27 static const int SJ_BROKEN_LEGS = 21;
28 static const int SJ_SHOCK = 22;
29 static const int SJ_STAMINA = 23;
30 static const int SJ_STAMINA_MISC = 24;
31 static const int SJ_ADS_RESET = 25;
32 static const int SJ_INVENTORY_FAILURE = 26;
33#ifdef DEVELOPER
34 static const int SJ_DEBUG_GET_IN_CAR = 200;
35#endif
36
37
38#ifdef DEVELOPER
39 //-------------------------------------------------------------
43
45 {
47 ctx.Write(car);
48 pPlayer.SendSyncJuncture(SJ_DEBUG_GET_IN_CAR, ctx);
49 }
50
52 {
53 if (!pCtx.Read(car))
54 return false;
55 return true;
56 }
57#endif
58
59 //-------------------------------------------------------------
63
64 static void SendDeath(DayZPlayer pPlayer, int pType, float pHitDir)
65 {
67
68 ctx.Write(pType);
69 ctx.Write(pHitDir);
70 pPlayer.SendSyncJuncture(SJ_DEATH, ctx);
71 }
72
74 {
75 if (!pCtx.Read(pType))
76 return false;
77 if (!pCtx.Read(pHitDir))
78 return false;
79
80 return true;
81 }
82
83 //-------------------------------------------------------------
87
88 static void SendDamageHit(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody)
89 {
91
92 ctx.Write(pType);
93 ctx.Write(pHitDir);
94 ctx.Write(pFullbody);
95 pPlayer.SendSyncJuncture(SJ_DAMAGE_HIT, ctx);
96 }
97
99 {
102
103 data.m_AnimType = pType;
104 data.m_HitDir = pHitDir;
105 data.m_Fullbody = pFullbody;
106 data.m_HasSource = pSource != null;
107 if (!pDamageResult)
108 data.m_HealthDamage = -1.0;
109 else
110 data.m_HealthDamage = pDamageResult.GetHighestDamage("Health");
111
112 ctx.Write(data);
113 pPlayer.SendSyncJuncture(SJ_DAMAGE_HIT, ctx);
114 }
115
117 {
118 if (!pCtx.Read(pType))
119 return false;
120 if (!pCtx.Read(pHitDir))
121 return false;
122 if (!pCtx.Read(pFullbody))
123 return false;
124 return true;
125 }
126
128 {
129 if (!pCtx.Read(pData))
130 return false;
131 return true;
132 }
133
134 //-------------------------------------------------------------
138
140 {
142 ctx.Write(pEnable);
143 ctx.Write(level);
144
145 pPlayer.SendSyncJuncture(SJ_INJURY, ctx);
146 }
147
149 {
150 if (!pCtx.Read(pEnable))
151 return false; // error
152 if (!pCtx.Read(level))
153 return false; // error
154
155 return true;
156 }
157
158 //-------------------------------------------------------------
162
164 {
166
167 ctx.Write(enable);
168
169 pPlayer.SendSyncJuncture(SJ_UNCONSCIOUSNESS, ctx);
170 }
171
173 {
174 if (!pCtx.Read(enable))
175 return false;
176 return true;
177 }
178
179 //-------------------------------------------------------------
183
185 {
187 ctx.Write(type);
188
189 pPlayer.SendSyncJuncture(SJ_PLAYER_FB_MODIFIER, ctx);
190 }
191
193 {
194 if (!pCtx.Read(type))
195 return false; // error
196 return true;
197 }
198
199 //-------------------------------------------------------------
203
205 {
207 ctx.Write(state_type);
208 ctx.Write(type);
209
210
211 pPlayer.SendSyncJuncture(SJ_PLAYER_ADD_MODIFIER, ctx);
212 }
213
215 {
216 if (!pCtx.Read(type))
217 return false; // error
218 return true;
219 }
220
221
222 //-------------------------------------------------------------
226
228 {
230 ctx.Write(state_type);
231 ctx.Write(anim_id);
232 ctx.Write(stance_mask);
233 ctx.Write(duration);
234 //ctx.Write(pPlayer);
235
236 pPlayer.SendSyncJuncture(SJ_PLAYER_STATES, ctx);
237 }
238
240 {
241 if (!pCtx.Read(anim_id))
242 return false; // error
243 if (!pCtx.Read(stance_mask))
244 return false; // error
245 if (!pCtx.Read(duration))
246 return false; // error
247 //if ( !pCtx.Read(pPlayer) )
248 //return false; // error
249 return true;
250 }
251
252
253 //-------------------------------------------------------------
257
263
265 {
266 return true;
267 }
268
269 //-------------------------------------------------------------
274 {
276 ctx.Write(AckID);
277 if (accept)
278 pPlayer.SendSyncJuncture(SJ_ACTION_ACK_ACCEPT, ctx);
279 else
280 pPlayer.SendSyncJuncture(SJ_ACTION_ACK_REJECT, ctx);
281 }
282
283
285 {
287 ctx.Write(AckID);
288 if (accept)
289 pPlayer.SendSyncJuncture(SJ_WEAPON_ACTION_ACK_ACCEPT, ctx);
290 else
291 pPlayer.SendSyncJuncture(SJ_WEAPON_ACTION_ACK_REJECT, ctx);
292 }
293
294 //-------------------------------------------------------------
298
299 static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
300 {
301 if (!pCtx.Read(amount))
302 return false; // error
303 return true;
304 }
305
306 static void SendKuruRequest(DayZPlayer pPlayer, float amount)
307 {
309 ctx.Write(amount);
310 pPlayer.SendSyncJuncture(SJ_KURU_REQUEST, ctx);
311 }
312
313 //-------------------------------------------------------------
317
319 {
321 ctx.Write(item);
322 ctx.Write(index);
323 ctx.Write(force);
324
325 pPlayer.SendSyncJuncture(SJ_QUICKBAR_SET_SHORTCUT, ctx);
326 }
327
329 {
331 ctx.Write(jamChance);
332
333 pPlayer.SendSyncJuncture(SJ_WEAPON_SET_JAMMING_CHANCE, ctx);
334 }
335
336 /*static bool ReadQuickbarSetShortcut(ParamsReadContext pCtx, out EntityAI item, out int index)
337 {
338 Param2<EntityAI,int> shortcutParam = new Param2<EntityAI,int>(NULL,-1);
339 if( pCtx.Read(shortcutParam))
340 {
341 item = shortcutParam.param1;
342 index = shortcutParam.param2;
343 return true;
344 }
345
346 return false;
347 }*/
348
350 {
352 ctx.Write(item);
353
354 pPlayer.SendSyncJuncture(SJ_DELETE_ITEM, ctx);
355 }
356
357
358 //-------------------------------------------------------------
362
364 {
366 ctx.Write(canPlaySound);
367 ctx.Write(currentState);
368 ctx.Write(localState);
369
370 pPlayer.SendSyncJuncture(SJ_BROKEN_LEGS, ctx);
371 }
372
374 {
375 if (!pCtx.Read(canPlaySound))
376 return false; // error
377 if (!pCtx.Read(currentState))
378 return false; // error
379 if (!pCtx.Read(localState))
380 return false;
381
382 return true;
383 }
384
385 static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
386 {
388 ctx.Write(currentState);
389
390 pPlayer.SendSyncJuncture(SJ_BROKEN_LEGS, ctx);
391 }
392
393 static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
394 {
395 if (!pCtx.Read(currentState))
396 return false;
397
398 return true;
399 }
400
401 //-------------------------------------------------------------
405
407 {
409 ctx.Write(shockValue);
410
411 pPlayer.SendSyncJuncture(SJ_SHOCK, ctx);
412 }
413
415 {
416 if (!pCtx.Read(shockValue))
417 return false; // error
418
419 return true;
420 }
421}
eBrokenLegs
Definition EBrokenLegs.c:2
eInjuryHandlerLevels
static void SendDamageHitEx(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody, TotalDamageResult pDamageResult, int pDamageType, EntityAI pSource, string pComponent, string pAmmoType, vector pModelPos)
static void SendWeaponJamChance(DayZPlayer pPlayer, float jamChance)
static void SendActionInterrupt(DayZPlayer pPlayer)
static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
static void SendKuruRequest(DayZPlayer pPlayer, float amount)
static void SendBrokenLegs(DayZPlayer pPlayer, bool canPlaySound, eBrokenLegs currentState, eBrokenLegs localState)
static bool ReadPlayerSymptomADDParams(ParamsReadContext pCtx, out int type)
static void SendPlayerSymptomFB(DayZPlayer pPlayer, DayZPlayerConstants anim_id, int state_type, int stance_mask, float duration)
static bool ReadShockParams(ParamsReadContext pCtx, out float shockValue)
static bool ReadDamageHitParamsEx(ParamsReadContext pCtx, out SyncHitInfo pData)
static void SendInjury(DayZPlayer pPlayer, bool pEnable, eInjuryHandlerLevels level)
static const int SJ_PLAYER_ADD_MODIFIER
static const int SJ_WEAPON_ACTION_ACK_REJECT
static void SendDeleteItem(DayZPlayer pPlayer, EntityAI item)
static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
static bool ReadBrokenLegsParams(ParamsReadContext pCtx, out bool canPlaySound, out eBrokenLegs currentState, out eBrokenLegs localState)
static const int SJ_QUICKBAR_SET_SHORTCUT
static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
static void SendPlayerFBModifier(PlayerBase pPlayer, int type)
static void SendShock(DayZPlayer pPlayer, float shockValue)
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
static void SendDeath(DayZPlayer pPlayer, int pType, float pHitDir)
static void SendQuickbarSetShortcut(DayZPlayer pPlayer, EntityAI item, int index, bool force=false)
static void SendPlayerSymptomADD(DayZPlayer pPlayer, int type, int state_type)
static bool ReadDamageHitParams(ParamsReadContext pCtx, out int pType, out float pHitDir, out bool pFullbody)
static void SendDamageHit(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody)
static const int SJ_WEAPON_SET_JAMMING_CHANCE
static bool ReadPlayerFBModifier(ParamsReadContext pCtx, out int type)
static bool ReadInjuryParams(ParamsReadContext pCtx, out bool pEnable, out eInjuryHandlerLevels level)
static void SendPlayerUnconsciousness(DayZPlayer pPlayer, bool enable)
static bool ReadDeathParams(ParamsReadContext pCtx, out int pType, out float pHitDir)
static void SendWeaponActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
static bool ReadActionInterruptParams(ParamsReadContext pCtx)
static bool ReadPlayerSymptomFBParams(ParamsReadContext pCtx, out DayZPlayerConstants anim_id, out int stance_mask, out float duration)
static const int SJ_WEAPON_RAISE_COMPLETED
static bool ReadPlayerUnconsciousnessParams(ParamsReadContext pCtx, out bool enable)
static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597