Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
hand_events.c
Go to the documentation of this file.
1
2
26
34
38class HandEventBase
39{
40 int m_EventID = 0;
41 int m_AnimationID = -1;
44
51
52 void HandEventBase (Man p = null, InventoryLocation src = null) { Class.CastTo(m_Player, p); m_Src = src; }
54
56 {
57 return m_Player && (m_Player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT && m_Player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_REMOTE);
58 }
59
60 bool IsOwner()
61 {
62 return m_Player && (m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER);
63 }
64
65 bool IsProxy()
66 {
67 return m_Player && (m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE || m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE);
68 }
69
70 void ReadFromContext (ParamsReadContext ctx) { } // actual read is in CreateHandEventFromContext
71
79
81 InventoryLocation GetSecondSrc () { return null; }
82
84 {
85 if (m_Src)
86 return m_Src.GetItem();
87 return null;
88 }
89 EntityAI GetSecondSrcEntity () { return null; }
90 InventoryLocation GetDst () { return null; }
91 InventoryLocation GetSecondDst () { return null; }
92 int GetAnimationID () { return m_AnimationID; }
93 bool AcquireInventoryJunctureFromServer (notnull Man player) { return false; }
94 bool CheckRequest () { return true; }
96 {
100 if (validation.m_IsRemote || validation.m_IsJuncture)
101 return true;
102
103 return CheckRequest();
104 }
105 bool CanPerformEvent () { return true; }
107 bool CheckRequestSrc () { return true; }
108 bool IsServerSideOnly () { return false; }
109
110 static HandEventBase HandEventFactory (HandEventID id, Man p = null, InventoryLocation src = null)
111 {
112 switch (id)
113 {
114 case HandEventID.UNKNOWN: return null;
115 case HandEventID.TAKE: return new HandEventTake(p, src);
116 case HandEventID.MOVETO: return new HandEventMoveTo(p, src);
117 case HandEventID.DROP: return new HandEventDrop(p, src);
118 case HandEventID.THROW: return new HandEventThrow(p, src);
119 case HandEventID.SWAP: return new HandEventSwap(p, src);
120 case HandEventID.FORCESWAP: return new HandEventForceSwap(p, src);
121 case HandEventID.DESTROY: return new HandEventDestroy(p, src);
122 case HandEventID.CREATED: return new HandEventCreated(p, src);
123 case HandEventID.DESTROYED: return new HandEventDestroyed(p, src);
124 case HandEventID.REPLACE: return new HandEventDestroyAndReplaceWithNew(p, src);
125 case HandEventID.REPLACE2: return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
126 case HandEventID.REPLACE3: return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
127 case HandEventID.REPLACED: return new HandEventReplaced(p, src);
128 case HandEventID.ANIMEVENT_CHANGE_HIDE: return HandAnimEventChanged(p, src);
129 case HandEventID.HUMANCOMMAND_ACTION_FINISHED : return HandEventHumanCommandActionFinished(p, src);
130 case HandEventID.HUMANCOMMAND_ACTION_ABORTED : return HandEventHumanCommandActionAborted(p, src);
131 }
132 Error("[hndfsm] HandEventFactory - unregistered hand event with id=" + id);
133 return null;
134 }
135
137 {
138 int eventID = -1;
139 if (!ctx.Read(eventID))
140 {
141 Error("[hndfsm] CreateHandEventFromContext - cannot read eventID");
142 return null;
143 }
144 Man player;
145 if (!ctx.Read(player))
146 {
147 Error("[hndfsm] CreateHandEventFromContext - cannot read player");
148 return null;
149 }
152
153 int animID = -1;
154 if (!ctx.Read(animID))
155 {
156 Error("[hndfsm] CreateHandEventFromContext - cannot read animID");
157 return null;
158 }
159 HandEventBase b = HandEventFactory(eventID, player, src);
160 if (b)
161 {
162 b.m_AnimationID = animID;
163 b.ReadFromContext(ctx);
164 }
165 return b;
166 }
167
168 string DumpToString ()
169 {
170 string res = "{ HandEv id=" + typename.EnumToString(HandEventID, GetEventID());
171 res = res + " pl=" + Object.GetDebugName(m_Player);
172 res = res + " src=" + InventoryLocation.DumpToStringNullSafe(m_Src);
173 res = res + " }";
174 return res;
175 }
176
178 {
180 if (!il)
181 {
182 il = GetSrc();
183 }
184
185 if (il && !m_Player.GetHumanInventory().HasInventoryReservation(il.GetItem(),il))
186 {
187 if (m_Player.GetHumanInventory().AddInventoryReservationEx(il.GetItem(), il, GameInventory.c_InventoryReservationTimeoutShortMS))
188 {
189 return true;
190 }
191 }
192
193 return false;
194 }
195
197 {
199 if (il)
200 {
201 il = GetSrc();
202 }
203
204 if (il)
205 {
206 m_Player.GetHumanInventory().ClearInventoryReservationEx(il.GetItem(), il);
207 }
208 }
209};
210
212{
213 void HandEventTake (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.TAKE; }
214
216 {
219 return dst;
220 }
221
222 override bool CheckRequestSrc ()
223 {
225 {
226 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequestSrc", m_Player.ToString() );
227 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
228 return false; // stale packet
229 }
230 return true;
231 }
232
237
238 override bool CanPerformEventEx(InventoryValidation validation)
239 {
240 if (validation.m_IsJuncture)
241 {
242 return true;
243 }
244
246 {
247 #ifdef ENABLE_LOGGING
249 {
250 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
251 }
252 #endif
253 //if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[desync] HandleInputData man=" + Object.GetDebugName(m_Player) + " CANNOT perform ev=" + DumpToString());
254 return false;
255 }
256
257 return super.CanPerformEventEx(validation);
258 }
259
260 override bool AcquireInventoryJunctureFromServer (notnull Man player)
261 {
264 if (src && dst)
265 {
266 return TryAcquireInventoryJunctureFromServer(player, src, dst);
267 }
268 Error("[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
269 return JunctureRequestResult.ERROR;
270 }
271};
272
273class HandEventMoveTo extends HandEventBase
274{
276
277 void HandEventMoveTo (Man p = null, InventoryLocation src = null, InventoryLocation dst = null) { m_EventID = HandEventID.MOVETO; m_Dst = dst; }
278
280 {
282 super.ReadFromContext(ctx);
283 m_Dst.ReadFromContext(ctx);
284 }
286 {
287 super.WriteToContext(ctx);
288 m_Dst.WriteToContext(ctx);
289 }
290
291 override InventoryLocation GetDst () { return m_Dst; }
292
293 override bool CheckRequestSrc ()
294 {
296 {
297 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
298 return false; // stale packet
299 }
300 return true;
301 }
302
303 override bool CheckRequest ()
304 {
305 if(m_Src && m_Dst && m_Src.GetItem() != m_Dst.GetItem())
306 return false;
307
309 }
310
311 override bool CanPerformEvent ()
312 {
314 {
315 #ifdef ENABLE_LOGGING
317 {
318 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
319 }
320 #endif
321 return false;
322 }
323 return true;
324 }
325
326 override bool AcquireInventoryJunctureFromServer (notnull Man player)
327 {
330 if (src && dst)
331 {
332 return TryAcquireInventoryJunctureFromServer(player, src, dst);
333 }
334 Error("[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
335 return JunctureRequestResult.ERROR;
336 }
337
338 override string DumpToString ()
339 {
340 string res = "{ HandEventMoveTo id=" + typename.EnumToString(HandEventID, GetEventID()) + " pl=" + Object.GetDebugName(m_Player) + " src=" + InventoryLocation.DumpToStringNullSafe(m_Src) + " dst=" + InventoryLocation.DumpToStringNullSafe(m_Dst) + " }";
341 return res;
342 }
343};
344
346class HandEventRemove extends HandEventBase
347{
349 {
350 return m_Dst;
351 }
352
353 override bool CheckRequestSrc ()
354 {
356 {
357 #ifdef ENABLE_LOGGING
359 {
360 Debug.InventoryHFSMLog("Check src - failed, src = " + InventoryLocation.DumpToStringNullSafe(GetSrc()), typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequestSrc", m_Player.ToString() );
361 }
362 #endif
363 return false; // stale packet
364 }
365 return true;
366 }
367
368 override bool CheckRequest ()
369 {
370 if(m_Src && m_Dst && m_Src.GetItem() != m_Dst.GetItem())
371 return false;
372
374 }
375
376 override bool CanPerformEvent ()
377 {
380
381 if (!dst)
382 {
383 #ifdef ENABLE_LOGGING
385 {
386 Debug.InventoryHFSMLog("CANNOT perform. Dst location is NULL!", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
387 }
388 #endif
389 return false;
390 }
391
392 if (dst.GetType() == InventoryLocationType.UNKNOWN)
393 {
394 #ifdef ENABLE_LOGGING
396 {
397 Debug.InventoryHFSMLog("CANNOT perform. Dst location type is UNKNOWN!", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
398 }
399 #endif
400 return false;
401 }
402
404 {
405 #ifdef ENABLE_LOGGING
407 {
408 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
409 }
410 #endif
411 return false;
412 }
413 return true;
414 }
415
416 override bool AcquireInventoryJunctureFromServer (notnull Man player)
417 {
420 if (src && dst)
421 {
422 return TryAcquireInventoryJunctureFromServer(player, src, dst);
423 }
424 Error("[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" + DumpToString());
425 return JunctureRequestResult.ERROR;
426 }
427
428 ref InventoryLocation m_Dst;
429};
430
432{
433 void HandEventDrop (Man p = null, InventoryLocation src = null)
434 {
435 m_EventID = HandEventID.DROP;
436 m_CanPerformDrop = true;
437 m_IsSet = false;
438
439 m_Dst = new InventoryLocation();
440 }
441
443 {
444 super.ReadFromContext(ctx);
445
447 ctx.Read(m_IsSet);
449 }
450
452 {
453 super.WriteToContext(ctx);
454
456 ctx.Write(m_IsSet);
458 }
459
460 override bool CheckRequestEx(InventoryValidation validation)
461 {
463 if (validation.m_Mode == InventoryMode.JUNCTURE && !validation.m_IsJuncture && IsAuthoritative())
464 {
465 m_IsSet = true;
467 }
468
469 if (!m_CanPerformDrop)
470 {
471 validation.m_Reason = InventoryValidationReason.DROP_PREVENTED;
472 return false;
473 }
474
475 return super.CheckRequestEx(validation);
476 }
477
478 override bool CanPerformEventEx(InventoryValidation validation)
479 {
481 if (validation.m_Mode == InventoryMode.JUNCTURE && !validation.m_IsJuncture && !validation.m_IsRemote && g_Game.IsClient())
482 {
483 return true;
484 }
485
487 if (!m_IsSet)
488 {
489 m_IsSet = true;
491 }
492
493 if (!m_CanPerformDrop)
494 {
495 return false;
496 }
497
498 return super.CanPerformEventEx(validation);
499 }
500
503};
504
505class HandEventThrow extends HandEventRemove
506{
507 void HandEventThrow (Man p = null, InventoryLocation src = null)
508 {
509 m_EventID = HandEventID.THROW;
510 if( src )
511 {
512 vector mat[4];
513 EntityAI entity = GetSrcEntity();
514 if (entity)
515 {
516 m_Dst = new InventoryLocation;
517 entity.GetTransform(mat);
518 m_Dst.SetGround(entity, mat);
519 }
520 else
521 {
522 Error("[hndfsm] HandEventThrow src entity null!");
523 }
524 }
525 }
526
528 {
529 super.ReadFromContext(ctx);
530
531 m_Dst = new InventoryLocation;
532 m_Dst.ReadFromContext(ctx);
533
534 float x, y, z;
535 ctx.Read(x);
536 ctx.Read(y);
537 ctx.Read(z);
538 m_Force[0] = x;
539 m_Force[1] = y;
540 m_Force[2] = z;
541 }
542
544 {
545 super.WriteToContext(ctx);
546
547 m_Dst.WriteToContext(ctx);
548
549 ctx.Write(m_Force[0]);
550 ctx.Write(m_Force[1]);
551 ctx.Write(m_Force[2]);
552 }
553
554 void SetForce(vector force) { m_Force = force; }
555 vector GetForce() { return m_Force; }
556
558};
559
560class HandEventSwap extends HandEventBase
561{
562 // super.m_Src == src location of new item (that will be taken)
563 ref InventoryLocation m_Dst;
567
568 void HandEventSwap (Man p = null, InventoryLocation src = null, InventoryLocation src2 = null, InventoryLocation dst = null, InventoryLocation dst2 = null)
569 {
570 m_EventID = HandEventID.SWAP;
571 m_Dst = dst;
572 m_Src2 = src2;
573 m_Dst2 = dst2;
574 }
575
577 {
578 super.ReadFromContext(ctx);
579
583
584 m_Src2.ReadFromContext(ctx);
585 m_Dst.ReadFromContext(ctx);
586 m_Dst2.ReadFromContext(ctx);
587 ctx.Read(m_Animation2ID);
588 }
589
591 {
592 super.WriteToContext(ctx);
593
594 m_Src2.WriteToContext(ctx);
595 m_Dst.WriteToContext(ctx);
596 m_Dst2.WriteToContext(ctx);
598 }
599
601 {
602 return m_Dst;
603 }
604
606 {
607 return m_Src2;
608 }
609
611 {
612 return m_Dst2;
613 }
614
616 {
617 return m_Src2.GetItem();
618 }
619
620 override bool CheckRequestSrc ()
621 {
622 //return false;
623
625 {
626 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src1 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src1=" + InventoryLocation.DumpToStringNullSafe(GetSrc()));
627 return false; // stale packet
628 }
630 {
631 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[cheat] HandleInputData man=" + Object.GetDebugName(m_Player) + " failed src2 check with cmd=" + typename.EnumToString(HandEventID, GetEventID()) + " src2=" + InventoryLocation.DumpToStringNullSafe(m_Src2));
632 return false; // stale packet
633 }
634 return true;
635 }
636
637 override bool CheckRequest ()
638 {
639 if (m_Src && m_Dst && m_Src.GetItem() != m_Dst.GetItem())
640 return false;
641
642 if (m_Src2 && m_Dst2 && m_Src2.GetItem() != m_Dst2.GetItem())
643 return false;
644
646 {
647 #ifdef ENABLE_LOGGING
649 {
650 Debug.InventoryHFSMLog("CheckSwapItemsRequest - failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
651 }
652 #endif
653 }
654 else if (!m_Player.GetHumanInventory().CanAddSwappedEntity(m_Src, m_Src2, m_Dst, m_Dst2))
655 {
656 #ifdef ENABLE_LOGGING
658 {
659 Debug.InventoryHFSMLog("CanAddSwappedEntity - failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
660 }
661 #endif
662 }
663 else
664 return true;
665
666 return false;
667 }
668
669 override bool CanPerformEvent ()
670 {
672 return true;
673
674 #ifdef ENABLE_LOGGING
676 {
677 Debug.InventoryHFSMLog("CANNOT perform", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
678 }
679 #endif
680 return false;
681 }
682
683 override bool AcquireInventoryJunctureFromServer (notnull Man player)
684 {
686 }
687
688 override string DumpToString ()
689 {
690 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) + " }";
691 }
692
694 {
695 DayZPlayer player = DayZPlayer.Cast(m_Player);
696 player.ForceStandUpForHeavyItemsSwap( m_Src.GetItem(), m_Src2.GetItem() );
697 }
698
699 override bool ReserveInventory()
700 {
701 if (!m_Player.GetHumanInventory().HasInventoryReservation(m_Dst.GetItem(), m_Dst) && !m_Player.GetHumanInventory().HasInventoryReservation(m_Dst2.GetItem(), m_Dst2))
702 {
703 if (m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst.GetItem(), m_Dst, GameInventory.c_InventoryReservationTimeoutShortMS))
704 {
705 if (m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst2.GetItem(), m_Dst2, GameInventory.c_InventoryReservationTimeoutShortMS))
706 {
707 return true;
708 }
709 else
710 {
711 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
712 }
713 }
714 }
715 return false;
716 }
717
719 {
720 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
721 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
722 }
723};
724
726{
727 void HandEventForceSwap (Man p = null, InventoryLocation src = null, InventoryLocation src2 = null, InventoryLocation dst = null, InventoryLocation dst2 = null) { m_EventID = HandEventID.FORCESWAP; }
728
729 override bool CheckRequest ()
730 {
731 if(m_Src && m_Dst && m_Src.GetItem() != m_Dst.GetItem())
732 return false;
733
734 if(m_Src2 && m_Dst2 && m_Src2.GetItem() != m_Dst2.GetItem())
735 return false;
736
737 bool test1 = false;
738 EntityAI inHands = m_Player.GetEntityInHands();
739 if (GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
740 {
742 #ifdef ENABLE_LOGGING
744 {
745 if (!test1)
746 Debug.InventoryHFSMLog("CheckSwapItemsRequest failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CheckRequest", m_Player.ToString() );
747 }
748 #endif
749 }
750 return test1;
751 }
752
753 override bool CanPerformEvent ()
754 {
755 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)
756 #ifdef ENABLE_LOGGING
758 {
759 if (!test2)
760 Debug.InventoryHFSMLog("CanForceSwapEntitiesEx failed", typename.EnumToString(HandEventID, GetEventID()) , "n/a", "CanPerformEvent", m_Player.ToString() );
761 }
762 #endif
763 return test2;
764 }
765};
766
767class HandEventDestroy extends HandEventBase
768{
769 void HandEventDestroy (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.DESTROY; }
770
771 override bool IsServerSideOnly () { return true; }
772};
773
774class HandEventCreated extends HandEventBase
775{
776 void HandEventCreated (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.CREATED; }
777};
778
779class HandEventDestroyed extends HandEventBase
780{
781 void HandEventDestroyed (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.DESTROYED; }
782};
783
785{
786 string m_Type;
788
789 void HandEvengReplaceWithNewBase (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE; m_Lambda = lambda; }
790
792 {
793 super.ReadFromContext(ctx);
794 ctx.Read(m_Type);
795 Error("[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
796 }
798 {
799 super.WriteToContext(ctx);
800 ctx.Write(m_Type);
801 Error("[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
802 }
803
804 override bool IsServerSideOnly () { return true; }
805
807 {
810 return dst;
811 }
812
813 override string DumpToString ()
814 {
815 string res = "{ HandEvenReplaceWithNewBase id=" + typename.EnumToString(HandEventID, GetEventID()) + " pl=" + Object.GetDebugName(m_Player) + " src=" + InventoryLocation.DumpToStringNullSafe(GetSrc()) + " lambda=" + m_Lambda + " dst=" + InventoryLocation.DumpToStringNullSafe(GetDst()) + " }";
816 return res;
817 }
818};
819
821{
822 void HandEventDestroyAndReplaceWithNew (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE; m_Lambda = lambda; }
823};
824
829
830class HandEventDestroyElsewhereAndReplaceWithNewInHands extends HandEventReplaceWithNewBase
831{
832 void HandEventDestroyElsewhereAndReplaceWithNewInHands (Man p = null, InventoryLocation src = null, ReplaceItemWithNewLambdaBase lambda = NULL) { m_EventID = HandEventID.REPLACE3; m_Lambda = lambda; }
833};
834
835class HandEventReplaced extends HandEventBase
836{
837 void HandEventReplaced (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.REPLACED; }
838};
839
840// anim events
841
842class HandAnimEventChanged extends HandEventBase
843{
844 void HandAnimEventChanged (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.ANIMEVENT_CHANGE_HIDE; }
845};
846
848{
849 switch (type)
850 {
851 case WeaponEvents.CHANGE_HIDE: return new HandAnimEventChanged(p, src);
852 case WeaponEvents.CHANGE_SHOW: return new HandAnimEventChanged(p, src);
853 }
854 return null;
855}
856
859class HandEventHumanCommandActionFinished extends HandEventBase
860{
861 void HandEventHumanCommandActionFinished (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.HUMANCOMMAND_ACTION_FINISHED; }
862};
865class HandEventHumanCommandActionAborted extends HandEventBase
866{
867 void HandEventHumanCommandActionAborted (Man p = null, InventoryLocation src = null) { m_EventID = HandEventID.HUMANCOMMAND_ACTION_ABORTED; }
868};
869
871
void syncDebugPrint(string s)
Definition debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
InventoryValidationReason
Definition inventory.c:37
@ UNKNOWN
24 - Any other error. Can be returned from any call.
map m_Player
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition debug.c:2
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:207
script counterpart to engine's class Inventory
Definition inventory.c:81
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Definition inventory.c:666
const float c_MaxItemDistanceRadius
anti-cheats
Definition inventory.c:815
const int c_InventoryReservationTimeoutShortMS
Definition inventory.c:715
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition inventory.c:1257
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)
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)
override InventoryLocation GetSecondSrc()
void HandEventHumanCommandActionFinished(Man p=null, InventoryLocation src=null)
override void ReadFromContext(ParamsReadContext ctx)
void HandAnimEventChanged(Man p=null, InventoryLocation src=null)
int m_Animation2ID
destination for old item that was in hands
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)
override bool CanPerformEventEx(InventoryValidation validation)
override InventoryLocation GetSecondDst()
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 int GetType()
returns type of InventoryLocation
proto native void SetHands(notnull EntityAI parent, EntityAI e)
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
InventoryMode m_Mode
Definition inventory.c:51
InventoryValidationReason m_Reason
Definition inventory.c:49
static bool IsInventoryHFSMLogEnable()
Definition debug.c:766
static bool IsSyncLogEnable()
Definition debug.c:776
base class for transformation operations (creating one item from another)
proto bool Write(void value_out)
proto bool Read(void value_in)
DayZGame g_Game
Definition dayzgame.c:3942
DayZPlayerInstanceType
defined in C++
@ DROP
Serializer ParamsReadContext
Definition gameplay.c:15
Serializer ParamsWriteContext
Definition gameplay.c:16
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
ERROR
Definition endebug.c:2
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static HandEventBase HandEventFactory(HandEventID id, Man p=null, InventoryLocation src=null)
bool m_IsRemote
Definition hand_events.c:50
JUNCTURE_ACQUIRED
Definition hand_events.c:30
static HandEventBase CreateHandEventFromContext(ParamsReadContext ctx)
int GetAnimationID()
Definition hand_events.c:92
bool IsAuthoritative()
Definition hand_events.c:55
InventoryLocation GetSrc()
Definition hand_events.c:80
DayZPlayer m_Player
Definition hand_events.c:42
ref InventoryLocation m_Src
Definition hand_events.c:43
bool m_IsJuncture
For action guards. Although we can guarantee the item will exist for remotes and juncture,...
Definition hand_events.c:49
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
JUNCTURE_DENIED
Definition hand_events.c:31
JunctureRequestResult
Definition hand_events.c:28
JUNCTURE_NOT_REQUIRED
Definition hand_events.c:29
m_EventID
bool CheckRequestEx(InventoryValidation validation)
Definition hand_events.c:95
HandEventID GetEventID()
Definition hand_events.c:53
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
@ TAKE
Definition hand_events.c:9
@ REPLACE
Definition hand_events.c:18
@ 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:60
void HandEventBase(Man p=null, InventoryLocation src=null)
Definition hand_events.c:52
string DumpToString()
EntityAI GetSrcEntity()
Definition hand_events.c:83
InventoryLocation GetDst()
Definition hand_events.c:90
bool IsProxy()
Definition hand_events.c:65
WeaponEvents
events
Definition human.c:969
Icon x
Icon y
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
InventoryLocationType
types of Inventory Location
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:35
EntityAI GetItem()