DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Hand_Events.c
Go to the documentation of this file.
1
2
7{
25};
26
28{
33}
34
38class HandEventBase
39{
40 int m_EventID = 0;
41 int m_AnimationID = -1;
44
45 void HandEventBase (Man p = null, InventoryLocation src = null) { Class.CastTo(m_Player, p); m_Src = src; }
47
49 {
50 return m_Player && (m_Player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT && m_Player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_REMOTE);
51 }
52
53 bool IsOwner()
54 {
55 return m_Player && (m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER);
56 }
57
58 bool IsProxy()
59 {
60 return m_Player && (m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE);
61 }
62
63 void ReadFromContext (ParamsReadContext ctx) { } // actual read is in CreateHandEventFromContext
64
66 {
67 ctx.Write(m_EventID);
68 ctx.Write(m_Player);
71 }
72
75 {
76 if (m_Src)
77 return m_Src.GetItem();
78 return null;
79 }
80 EntityAI GetSecondSrcEntity () { return null; }
81 InventoryLocation GetDst () { return null; }
82 int GetAnimationID () { return m_AnimationID; }
83 bool AcquireInventoryJunctureFromServer (notnull Man player) { return false; }
84 bool CheckRequest () { return true; }
85 bool CheckRequestEx (InventoryValidation validation) { return CheckRequest(); }
86 bool CanPerformEvent () { return true; }
88 bool CheckRequestSrc () { return true; }
89 bool IsServerSideOnly () { return false; }
90
91 static HandEventBase HandEventFactory (HandEventID id, Man p = null, InventoryLocation src = null)
92 {
93 switch (id)
94 {
95 case HandEventID.UNKNOWN: return null;
96 case HandEventID.TAKE: return new HandEventTake(p, src);
97 case HandEventID.MOVETO: return new HandEventMoveTo(p, src);
98 case HandEventID.DROP: return new HandEventDrop(p, src);
99 case HandEventID.THROW: return new HandEventThrow(p, src);
100 case HandEventID.SWAP: return new HandEventSwap(p, src);
101 case HandEventID.FORCESWAP: return new HandEventForceSwap(p, src);
102 case HandEventID.DESTROY: return new HandEventDestroy(p, src);
103 case HandEventID.CREATED: return new HandEventCreated(p, src);
104 case HandEventID.DESTROYED: return new HandEventDestroyed(p, src);
105 case HandEventID.REPLACE: return new HandEventDestroyAndReplaceWithNew(p, src);
106 case HandEventID.REPLACE2: return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
107 case HandEventID.REPLACE3: return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
108 case HandEventID.REPLACED: return new HandEventReplaced(p, src);
109 case HandEventID.ANIMEVENT_CHANGE_HIDE: return HandAnimEventChanged(p, src);
110 case HandEventID.HUMANCOMMAND_ACTION_FINISHED : return HandEventHumanCommandActionFinished(p, src);
111 case HandEventID.HUMANCOMMAND_ACTION_ABORTED : return HandEventHumanCommandActionAborted(p, src);
112 }
113 Error("[hndfsm] HandEventFactory - unregistered hand event with id=" + id);
114 return null;
115 }
116
118 {
119 int eventID = -1;
120 if (!ctx.Read(eventID))
121 {
122 Error("[hndfsm] CreateHandEventFromContext - cannot read eventID");
123 return null;
124 }
125 Man player;
126 if (!ctx.Read(player))
127 {
128 Error("[hndfsm] CreateHandEventFromContext - cannot read player");
129 return null;
130 }
133
134 int animID = -1;
135 if (!ctx.Read(animID))
136 {
137 Error("[hndfsm] CreateHandEventFromContext - cannot read animID");
138 return null;
139 }
140 HandEventBase b = HandEventFactory(eventID, player, src);
141 if (b)
142 {
143 b.m_AnimationID = animID;
144 b.ReadFromContext(ctx);
145 }
146 return b;
147 }
148
149 string DumpToString ()
150 {
151 string res = "{ HandEv id=" + typename.EnumToString(HandEventID, GetEventID());
152 res = res + " pl=" + Object.GetDebugName(m_Player);
153 res = res + " src=" + InventoryLocation.DumpToStringNullSafe(m_Src);
154 res = res + " }";
155 return res;
156 }
157
159 {
161 if( dst && !m_Player.GetHumanInventory().AddInventoryReservationEx(dst.GetItem(), dst, GameInventory.c_InventoryReservationTimeoutShortMS) )
162 {
163 return false;
164 }
165 return true;
166 }
167
169 {
171 if(dst)
172 {
173 m_Player.GetHumanInventory().ClearInventoryReservationEx(dst.GetItem(), dst);
174 }
175 }
176};
177
178class HandEventTake extends HandEventBase
179{
180 void HandEventTake (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.TAKE; }
181
183 {
186 return dst;
187 }
188
189 override bool CheckRequestSrc ()
190 {
192 {
193 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequestSrc", m_Player.ToString() );
194 syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
195 return false; // stale packet
196 }
197 return true;
198 }
199
200 override bool CheckRequest ()
201 {
203 }
204
205 override bool CanPerformEvent ()
206 {
208 {
209 #ifdef DEVELOPER
211 {
212 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
213 }
214 #endif
215 //hndDebugPrint("[desync] HandleInputData man=" + Object.GetDebugName(m_Player) + " CANNOT perform ev=" + DumpToString());
216 return false;
217 }
218 return true;
219 }
220
221 override bool AcquireInventoryJunctureFromServer (notnull Man player)
222 {
225 if (src && dst)
226 {
227 return TryAcquireInventoryJunctureFromServer(player, src, dst);
228 }
229 Error("[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
230 return JunctureRequestResult.ERROR;
231 }
232};
233
234class HandEventMoveTo extends HandEventBase
235{
237
238 void HandEventMoveTo (Man p = null, InventoryLocation src = null, InventoryLocation dst = null) { m_EventID = HandEventID.MOVETO; m_Dst = dst; }
239
241 {
242 m_Dst = new InventoryLocation;
243 super.ReadFromContext(ctx);
244 m_Dst.ReadFromContext(ctx);
245 }
247 {
248 super.WriteToContext(ctx);
249 m_Dst.WriteToContext(ctx);
250 }
251
252 override InventoryLocation GetDst () { return m_Dst; }
253
254 override bool CheckRequestSrc ()
255 {
257 {
258 syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
259 return false; // stale packet
260 }
261 return true;
262 }
263
264 override bool CheckRequest ()
265 {
267 }
268
269 override bool CanPerformEvent ()
270 {
272 {
273 #ifdef DEVELOPER
275 {
276 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
277 }
278 #endif
279 return false;
280 }
281 return true;
282 }
283
284 override bool AcquireInventoryJunctureFromServer (notnull Man player)
285 {
288 if (src && dst)
289 {
290 return TryAcquireInventoryJunctureFromServer(player, src, dst);
291 }
292 Error("[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
293 return JunctureRequestResult.ERROR;
294 }
295
296 override string DumpToString ()
297 {
298 string res = "{ HandEventMoveTo id=" + typename.EnumToString(HandEventID, GetEventID()) + " pl=" + Object.GetDebugName(m_Player) + " src=" + InventoryLocation.DumpToStringNullSafe(m_Src) + " dst=" + InventoryLocation.DumpToStringNullSafe(m_Dst) + " }";
299 return res;
300 }
301};
302
304class HandEventRemove extends HandEventBase
305{
307 {
308 return m_Dst;
309 }
310
311 override bool CheckRequestSrc ()
312 {
314 {
315 #ifdef DEVELOPER
317 {
318 Debug.InventoryHFSMLog("Check src - failed, src = " + InventoryLocation.DumpToStringNullSafe(GetSrc()), typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequestSrc", m_Player.ToString() );
319 }
320 #endif
321 return false; // stale packet
322 }
323 return true;
324 }
325
326 override bool CheckRequest ()
327 {
329 }
330
331 override bool CanPerformEvent ()
332 {
334 {
335 #ifdef DEVELOPER
337 {
338 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
339 }
340 #endif
341 return false;
342 }
343 return true;
344 }
345
346 override bool AcquireInventoryJunctureFromServer (notnull Man player)
347 {
350 if (src && dst)
351 {
352 return TryAcquireInventoryJunctureFromServer(player, src, dst);
353 }
354 Error("[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
355 return JunctureRequestResult.ERROR;
356 }
357
358 ref InventoryLocation m_Dst;
359};
360
361class HandEventDrop extends HandEventRemove
362{
363 void HandEventDrop (Man p = null, InventoryLocation src = null)
364 {
365 m_EventID = HandEventID.DROP;
366 m_CanPerformDrop = true;
367 }
368
370 {
371 super.ReadFromContext(ctx);
372
373 ctx.Read(m_CanPerformDrop);
375 if (!m_Dst)
376 {
377 m_Dst = new InventoryLocation();
378 }
379 }
380
382 {
383 super.WriteToContext(ctx);
384
385 ctx.Write(m_CanPerformDrop);
387 }
388
389 override bool CheckRequestEx(InventoryValidation validation)
390 {
392 if (!validation.m_IsJuncture && IsAuthoritative())
393 {
394 m_CanPerformDrop = GameInventory.SetGroundPosByOwner(m_Player, GetSrcEntity(), m_Dst);
395 }
396
397 if (!m_CanPerformDrop)
398 {
399 validation.m_Reason = InventoryValidationReason.DROP_PREVENTED;
400 return false;
401 }
402
403 return super.CheckRequestEx(validation);
404 }
405
406 override bool CanPerformEventEx(InventoryValidation validation)
407 {
408 if (!m_CanPerformDrop)
409 {
410 return false;
411 }
412
414 if (!validation.m_IsJuncture && !validation.m_IsRemote && !GetDst() && (GetGame().IsMultiplayer() && GetGame().IsClient()))
415 {
416 return true;
417 }
418
420 if (!validation.m_IsRemote && !GetDst())
421 {
422 m_Dst = new InventoryLocation();
423 m_CanPerformDrop = GameInventory.SetGroundPosByOwner(m_Player, GetSrcEntity(), m_Dst);
424
425 if (!m_CanPerformDrop)
426 {
427 validation.m_Reason = InventoryValidationReason.DROP_PREVENTED;
428 return false;
429 }
430 }
431
432 return super.CanPerformEventEx(validation);
433 }
434
436};
437
438class HandEventThrow extends HandEventRemove
439{
440 void HandEventThrow (Man p = null, InventoryLocation src = null)
441 {
442 m_EventID = HandEventID.THROW;
443 if( src )
444 {
445 vector mat[4];
446 EntityAI entity = GetSrcEntity();
447 if (entity)
448 {
449 m_Dst = new InventoryLocation;
450 entity.GetTransform(mat);
451 m_Dst.SetGround(entity, mat);
452 }
453 else
454 {
455 Error("[hndfsm] HandEventThrow src entity null!");
456 }
457 }
458 }
459
461 {
462 super.ReadFromContext(ctx);
463
464 m_Dst = new InventoryLocation;
465 m_Dst.ReadFromContext(ctx);
466
467 float x, y, z;
468 ctx.Read(x);
469 ctx.Read(y);
470 ctx.Read(z);
471 m_Force[0] = x;
472 m_Force[1] = y;
473 m_Force[2] = z;
474 }
475
477 {
478 super.WriteToContext(ctx);
479
480 m_Dst.WriteToContext(ctx);
481
482 ctx.Write(m_Force[0]);
483 ctx.Write(m_Force[1]);
484 ctx.Write(m_Force[2]);
485 }
486
487 void SetForce(vector force) { m_Force = force; }
488 vector GetForce() { return m_Force; }
489
491};
492
493class HandEventSwap extends HandEventBase
494{
495 // super.m_Src == src location of new item (that will be taken)
496 ref InventoryLocation m_Dst;
499 int m_Animation2ID = -1;
500
501 void HandEventSwap (Man p = null, InventoryLocation src = null, InventoryLocation src2 = null, InventoryLocation dst = null, InventoryLocation dst2 = null)
502 {
503 m_EventID = HandEventID.SWAP;
504 m_Dst = dst;
505 m_Src2 = src2;
506 m_Dst2 = dst2;
507 }
508
510 {
511 super.ReadFromContext(ctx);
512
513 m_Src2 = new InventoryLocation;
514 m_Dst = new InventoryLocation;
515 m_Dst2 = new InventoryLocation;
516
517 m_Src2.ReadFromContext(ctx);
518 m_Dst.ReadFromContext(ctx);
519 m_Dst2.ReadFromContext(ctx);
520 ctx.Read(m_Animation2ID);
521 }
522
524 {
525 super.WriteToContext(ctx);
526
527 m_Src2.WriteToContext(ctx);
528 m_Dst.WriteToContext(ctx);
529 m_Dst2.WriteToContext(ctx);
530 ctx.Write(m_Animation2ID);
531 }
532
534 {
535 return m_Dst;
536 }
537
539 {
540 return m_Src2.GetItem();
541 }
542
543 override bool CheckRequestSrc ()
544 {
546 {
547 syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
548 return false; // stale packet
549 }
551 {
552 syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src2 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src2=" + InventoryLocation.DumpToStringNullSafe(m_Src2));
553 return false; // stale packet
554 }
555 return true;
556 }
557
558 override bool CheckRequest ()
559 {
561 {
562 #ifdef DEVELOPER
564 {
565 Debug.InventoryHFSMLog("CheckSwapItemsRequest - failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
566 }
567 #endif
568 }
569 else if (!m_Player.GetHumanInventory().CanAddSwappedEntity(m_Src, m_Src2, m_Dst, m_Dst2))
570 {
571 #ifdef DEVELOPER
573 {
574 Debug.InventoryHFSMLog("CanAddSwappedEntity - failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
575 }
576 #endif
577 }
578 else
579 return true;
580
581 return false;
582 }
583
584 override bool CanPerformEvent ()
585 {
586 if (GameInventory.CanForceSwapEntitiesEx(GetSrc().GetItem(), m_Dst, m_Src2.GetItem(), m_Dst2))
587 return true;
588
589 #ifdef DEVELOPER
591 {
592 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
593 }
594 #endif
595 return false;
596 }
597
598 override bool AcquireInventoryJunctureFromServer (notnull Man player)
599 {
600 return TryAcquireTwoInventoryJuncturesFromServer(player, m_Src, m_Src2, m_Dst, m_Dst2);
601 }
602
603 override string DumpToString ()
604 {
605 return "{ HandEventSwap id=" + typename.EnumToString(HandEventID, GetEventID()) + " pl=" + Object.GetDebugName(m_Player) + " src1=" + InventoryLocation.DumpToStringNullSafe(m_Src) + " src2=" + InventoryLocation.DumpToStringNullSafe(m_Src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(m_Dst) + " dst2=" + InventoryLocation.DumpToStringNullSafe(m_Dst2) + " }";
606 }
607
609 {
610 DayZPlayer player = DayZPlayer.Cast(m_Player);
611 player.ForceStandUpForHeavyItemsSwap( m_Src.GetItem(), m_Src2.GetItem() );
612 }
613
614 override bool ReserveInventory()
615 {
616 if( !m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst.GetItem(), m_Dst, GameInventory.c_InventoryReservationTimeoutShortMS) )
617 {
618 return false;
619 }
620 if( !m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst2.GetItem(), m_Dst2, GameInventory.c_InventoryReservationTimeoutShortMS) )
621 {
622 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
623 return false;
624 }
625 return true;
626 }
627
629 {
630 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
631 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
632 }
633};
634
635class HandEventForceSwap extends HandEventSwap
636{
637 void HandEventForceSwap (Man p = null, InventoryLocation src = null, InventoryLocation src2 = null, InventoryLocation dst = null, InventoryLocation dst2 = null) { m_EventID = HandEventID.FORCESWAP; }
638
639 override bool CheckRequest ()
640 {
641 bool test1 = false;
642 EntityAI inHands = m_Player.GetHumanInventory().GetEntityInHands();
643 if (GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
644 {
646 #ifdef DEVELOPER
648 {
649 if (!test1)
650 Debug.InventoryHFSMLog("CheckSwapItemsRequest failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
651 }
652 #endif
653 }
654 return test1;
655 }
656
657 override bool CanPerformEvent ()
658 {
659 bool test2 = GameInventory.CanForceSwapEntitiesEx(m_Src.GetItem(), m_Dst, m_Src2.GetItem(), m_Dst2); // null here means 'do not search for dst2' (already have valid one from constructor)
660 #ifdef DEVELOPER
662 {
663 if (!test2)
664 Debug.InventoryHFSMLog("CanForceSwapEntitiesEx failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
665 }
666 #endif
667 return test2;
668 }
669};
670
671class HandEventDestroy extends HandEventBase
672{
673 void HandEventDestroy (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.DESTROY; }
674
675 override bool IsServerSideOnly () { return true; }
676};
677
678class HandEventCreated extends HandEventBase
679{
680 void HandEventCreated (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.CREATED; }
681};
682
683class HandEventDestroyed extends HandEventBase
684{
685 void HandEventDestroyed (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.DESTROYED; }
686};
687
689{
690 string m_Type;
692
693 void HandEvengReplaceWithNewBase (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE; m_Lambda = lambda; }
694
696 {
697 super.ReadFromContext(ctx);
698 ctx.Read(m_Type);
699 Error("[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
700 }
702 {
703 super.WriteToContext(ctx);
704 ctx.Write(m_Type);
705 Error("[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
706 }
707
708 override bool IsServerSideOnly () { return true; }
709
711 {
714 return dst;
715 }
716
717 override string DumpToString ()
718 {
719 string res = "{ HandEvenReplaceWithNewBase id=" + typename.EnumToString(HandEventID, GetEventID()) + " pl=" + Object.GetDebugName(m_Player) + " src=" + InventoryLocation.DumpToStringNullSafe(GetSrc()) + " lambda=" + m_Lambda + " dst=" + InventoryLocation.DumpToStringNullSafe(GetDst()) + " }";
720 return res;
721 }
722};
723
725{
726 void HandEventDestroyAndReplaceWithNew (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE; m_Lambda = lambda; }
727};
728
729class HandEventDestroyAndReplaceWithNewElsewhere extends HandEventDestroyAndReplaceWithNew
730{
731 void HandEventDestroyAndReplaceWithNewElsewhere (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE3; m_Lambda = lambda; }
732};
733
734class HandEventDestroyElsewhereAndReplaceWithNewInHands extends HandEventReplaceWithNewBase
735{
736 void HandEventDestroyElsewhereAndReplaceWithNewInHands (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE3; m_Lambda = lambda; }
737};
738
739class HandEventReplaced extends HandEventBase
740{
741 void HandEventReplaced (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.REPLACED; }
742};
743
744// anim events
745
746class HandAnimEventChanged extends HandEventBase
747{
748 void HandAnimEventChanged (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.ANIMEVENT_CHANGE_HIDE; }
749};
750
752{
753 switch (type)
754 {
755 case WeaponEvents.CHANGE_HIDE: return new HandAnimEventChanged(p, src);
756 case WeaponEvents.CHANGE_SHOW: return new HandAnimEventChanged(p, src);
757 }
758 return null;
759}
760
763class HandEventHumanCommandActionFinished extends HandEventBase
764{
765 void HandEventHumanCommandActionFinished (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.HUMANCOMMAND_ACTION_FINISHED; }
766};
769class HandEventHumanCommandActionAborted extends HandEventBase
770{
771 void HandEventHumanCommandActionAborted (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.HUMANCOMMAND_ACTION_ABORTED; }
772};
773
775
void syncDebugPrint(string s)
Definition Debug.c:1
InventoryValidationReason
Definition Inventory.c:35
eBleedingSourceType m_Type
DayZPlayer m_Player
Definition Hand_Events.c:42
static HandEventBase HandEventFactory(HandEventID id, Man p=null, InventoryLocation src=null)
Definition Hand_Events.c:91
JUNCTURE_ACQUIRED
Definition Hand_Events.c:30
static HandEventBase CreateHandEventFromContext(ParamsReadContext ctx)
ERROR
Definition Hand_Events.c:32
int GetAnimationID()
Definition Hand_Events.c:82
bool IsAuthoritative()
Definition Hand_Events.c:48
InventoryLocation GetSrc()
Definition Hand_Events.c:73
ref InventoryLocation m_Src
Definition Hand_Events.c:43
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
JUNCTURE_DENIED
Definition Hand_Events.c:31
bool CanPerformEventEx(InventoryValidation validation)
Definition Hand_Events.c:87
JunctureRequestResult
Definition Hand_Events.c:28
JUNCTURE_NOT_REQUIRED
Definition Hand_Events.c:29
m_EventID
bool CheckRequestEx(InventoryValidation validation)
Definition Hand_Events.c:85
HandEventID GetEventID()
Definition Hand_Events.c:46
HandEventID
events
Definition Hand_Events.c:7
@ FORCESWAP
Definition Hand_Events.c:14
@ HUMANCOMMAND_ACTION_FINISHED
Definition Hand_Events.c:22
@ DESTROYED
Definition Hand_Events.c:17
@ DESTROY
Definition Hand_Events.c:15
@ MOVETO
Definition Hand_Events.c:10
@ UNKNOWN
Definition Hand_Events.c:8
@ TAKE
Definition Hand_Events.c:9
@ REPLACE
Definition Hand_Events.c:18
@ DROP
Definition Hand_Events.c:11
@ REPLACED
Definition Hand_Events.c:21
@ REPLACE2
Definition Hand_Events.c:19
@ REPLACE3
Definition Hand_Events.c:20
@ ANIMEVENT_CHANGE_HIDE
Definition Hand_Events.c:24
@ CREATED
Definition Hand_Events.c:16
@ THROW
Definition Hand_Events.c:12
@ HUMANCOMMAND_ACTION_ABORTED
Definition Hand_Events.c:23
@ SWAP
swapping from ground
Definition Hand_Events.c:13
int m_AnimationID
Definition Hand_Events.c:41
bool IsOwner()
Definition Hand_Events.c:53
string DumpToString()
EntityAI GetSrcEntity()
Definition Hand_Events.c:74
InventoryLocation GetDst()
Definition Hand_Events.c:81
bool IsProxy()
Definition Hand_Events.c:58
Icon x
Icon y
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
bool TryAcquireInventoryJunctureFromServer(notnull Man player, notnull InventoryLocation src, notnull InventoryLocation dst)
Definition Junctures.c:2
bool TryAcquireTwoInventoryJuncturesFromServer(notnull Man player, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
Definition Junctures.c:29
EntityAI GetItem()
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Debug.c:14
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:158
script counterpart to engine's class Inventory
Definition Inventory.c:77
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Definition Inventory.c:638
const float c_MaxItemDistanceRadius
anti-cheats
Definition Inventory.c:783
const int c_InventoryReservationTimeoutShortMS
Definition Inventory.c:684
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition Inventory.c:1199
static proto native bool CheckMoveToDstRequest(notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
static proto native bool CheckRequestSrc(notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
static proto native bool CheckSwapItemsRequest(notnull Man requestingPlayer, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
Abstracted event, not to be used, only inherited.
void CheckAndExecuteForceStandUp()
override bool ReserveInventory()
void HandEventHumanCommandActionAborted(Man p=null, InventoryLocation src=null)
void HandEventHumanCommandActionFinished(Man p=null, InventoryLocation src=null)
override void ReadFromContext(ParamsReadContext ctx)
void HandAnimEventChanged(Man p=null, InventoryLocation src=null)
override EntityAI GetSecondSrcEntity()
override void ClearInventoryReservation()
override bool CheckRequest()
void HandEventCreated(Man p=null, InventoryLocation src=null)
ref InventoryLocation m_Dst
override string DumpToString()
void HandEventTake(Man p=null, InventoryLocation src=null)
void HandEventMoveTo(Man p=null, InventoryLocation src=null, InventoryLocation dst=null)
destination for item in hands
override bool CanPerformEvent()
ref InventoryLocation m_Src2
destination for new item (i.e. hands)
void HandEvengReplaceWithNewBase(Man p=null, InventoryLocation src=null, ReplaceItemWithNewLambdaBase lambda=NULL)
void HandEventDestroyed(Man p=null, InventoryLocation src=null)
override bool AcquireInventoryJunctureFromServer(notnull Man player)
ref InventoryLocation m_Dst2
src of old item in hands
override void WriteToContext(ParamsWriteContext ctx)
override bool IsServerSideOnly()
void HandEventSwap(Man p=null, InventoryLocation src=null, InventoryLocation src2=null, InventoryLocation dst=null, InventoryLocation dst2=null)
void HandEventDestroy(Man p=null, InventoryLocation src=null)
void HandEventReplaced(Man p=null, InventoryLocation src=null)
override bool CheckRequestSrc()
override InventoryLocation GetDst()
ref ReplaceItemWithNewLambdaBase m_Lambda
void HandEventDestroyAndReplaceWithNewElsewhere(Man p=null, InventoryLocation src=null, ReplaceItemWithNewLambdaBase lambda=NULL)
override void ReadFromContext(ParamsReadContext ctx)
void SetForce(vector force)
void HandEventDrop(Man p=null, InventoryLocation src=null)
void HandEventThrow(Man p=null, InventoryLocation src=null)
override void WriteToContext(ParamsWriteContext ctx)
vector GetForce()
override bool CanPerformEventEx(InventoryValidation validation)
override bool CheckRequestEx(InventoryValidation validation)
void HandEventDestroyAndReplaceWithNew(Man p=null, InventoryLocation src=null, ReplaceItemWithNewLambdaBase lambda=NULL)
void HandEventDestroyElsewhereAndReplaceWithNewInHands(Man p=null, InventoryLocation src=null, ReplaceItemWithNewLambdaBase lambda=NULL)
void HandEventForceSwap(Man p=null, InventoryLocation src=null, InventoryLocation src2=null, InventoryLocation dst=null, InventoryLocation dst2=null)
override bool CheckRequest()
override bool CanPerformEvent()
InventoryLocation.
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
InventoryValidationReason m_Reason
Definition Inventory.c:47
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:620
base class for transformation operations (creating one item from another)
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto bool Read(void value_in)
DayZPlayerInstanceType
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
WeaponEvents
events
Definition human.c:945