84 return m_Src.GetItem();
87 EntityAI GetSecondSrcEntity () {
return null; }
90 bool AcquireInventoryJunctureFromServer (notnull Man player) {
return false; }
91 bool CheckRequest () {
return true; }
97 if (validation.m_IsRemote || validation.m_IsJuncture)
100 return CheckRequest();
102 bool CanPerformEvent () {
return true; }
104 bool CheckRequestSrc () {
return true; }
105 bool IsServerSideOnly () {
return false; }
112 case HandEventID.TAKE:
return new HandEventTake(p, src);
113 case HandEventID.MOVETO:
return new HandEventMoveTo(p, src);
114 case HandEventID.DROP:
return new HandEventDrop(p, src);
115 case HandEventID.THROW:
return new HandEventThrow(p, src);
117 case HandEventID.FORCESWAP:
return new HandEventForceSwap(p, src);
118 case HandEventID.DESTROY:
return new HandEventDestroy(p, src);
119 case HandEventID.CREATED:
return new HandEventCreated(p, src);
120 case HandEventID.DESTROYED:
return new HandEventDestroyed(p, src);
122 case HandEventID.REPLACE2:
return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
123 case HandEventID.REPLACE3:
return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
124 case HandEventID.REPLACED:
return new HandEventReplaced(p, src);
125 case HandEventID.ANIMEVENT_CHANGE_HIDE:
return HandAnimEventChanged(p, src);
126 case HandEventID.HUMANCOMMAND_ACTION_FINISHED :
return HandEventHumanCommandActionFinished(p, src);
127 case HandEventID.HUMANCOMMAND_ACTION_ABORTED :
return HandEventHumanCommandActionAborted(p, src);
129 Error(
"[hndfsm] HandEventFactory - unregistered hand event with id=" +
id);
136 if (!ctx.Read(eventID))
138 Error(
"[hndfsm] CreateHandEventFromContext - cannot read eventID");
142 if (!ctx.Read(player))
144 Error(
"[hndfsm] CreateHandEventFromContext - cannot read player");
151 if (!ctx.Read(animID))
153 Error(
"[hndfsm] CreateHandEventFromContext - cannot read animID");
159 b.m_AnimationID = animID;
160 b.ReadFromContext(ctx);
165 string DumpToString ()
174 bool ReserveInventory()
182 if (il && !
m_Player.GetHumanInventory().HasInventoryReservation(il.GetItem(),il))
193 void ClearInventoryReservation()
203 m_Player.GetHumanInventory().ClearInventoryReservationEx(il.GetItem(), il);
237 if (validation.m_IsJuncture)
244 #ifdef ENABLE_LOGGING
254 return super.CanPerformEventEx(validation);
265 Error(
"[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
279 super.ReadFromContext(ctx);
280 m_Dst.ReadFromContext(ctx);
284 super.WriteToContext(ctx);
285 m_Dst.WriteToContext(ctx);
309 #ifdef ENABLE_LOGGING
328 Error(
"[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
351 #ifdef ENABLE_LOGGING
374 #ifdef ENABLE_LOGGING
385 #ifdef ENABLE_LOGGING
388 Debug.InventoryHFSMLog(
"CANNOT perform. Dst location type is UNKNOWN!",
typename.EnumToString(
HandEventID,
GetEventID()) ,
"n/a",
"CanPerformEvent",
m_Player.ToString() );
396 #ifdef ENABLE_LOGGING
415 Error(
"[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
427 m_CanPerformDrop =
true;
432 super.ReadFromContext(ctx);
439 ctx.Read(m_CanPerformDrop);
445 super.WriteToContext(ctx);
447 ctx.Write(m_CanPerformDrop);
459 if (!m_CanPerformDrop)
465 return super.CheckRequestEx(validation);
470 if (!m_CanPerformDrop)
476 if (!validation.m_IsJuncture && !validation.m_IsRemote && !
GetDst() && (
GetGame().IsMultiplayer() &&
GetGame().IsClient()))
482 if (!validation.m_IsRemote && !
GetDst())
487 if (!m_CanPerformDrop)
494 return super.CanPerformEventEx(validation);
497 bool m_CanPerformDrop;
512 entity.GetTransform(mat);
513 m_Dst.SetGround(entity, mat);
517 Error(
"[hndfsm] HandEventThrow src entity null!");
524 super.ReadFromContext(ctx);
527 m_Dst.ReadFromContext(ctx);
540 super.WriteToContext(ctx);
542 m_Dst.WriteToContext(ctx);
544 ctx.Write(m_Force[0]);
545 ctx.Write(m_Force[1]);
546 ctx.Write(m_Force[2]);
549 void SetForce(
vector force) { m_Force = force; }
550 vector GetForce() {
return m_Force; }
561 int m_Animation2ID = -1;
573 super.ReadFromContext(ctx);
579 m_Src2.ReadFromContext(ctx);
580 m_Dst.ReadFromContext(ctx);
581 m_Dst2.ReadFromContext(ctx);
582 ctx.Read(m_Animation2ID);
587 super.WriteToContext(ctx);
589 m_Src2.WriteToContext(ctx);
590 m_Dst.WriteToContext(ctx);
591 m_Dst2.WriteToContext(ctx);
592 ctx.Write(m_Animation2ID);
602 return m_Src2.GetItem();
622 override bool CheckRequest ()
626 #ifdef ENABLE_LOGGING
633 else if (!
m_Player.GetHumanInventory().CanAddSwappedEntity(
m_Src, m_Src2, m_Dst, m_Dst2))
635 #ifdef ENABLE_LOGGING
648 override bool CanPerformEvent ()
653 #ifdef ENABLE_LOGGING
672 void CheckAndExecuteForceStandUp()
675 player.ForceStandUpForHeavyItemsSwap(
m_Src.GetItem(), m_Src2.GetItem() );
680 if (!
m_Player.GetHumanInventory().HasInventoryReservation(m_Dst.GetItem(), m_Dst) && !
m_Player.GetHumanInventory().HasInventoryReservation(m_Dst2.GetItem(), m_Dst2))
690 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
699 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
700 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
712 if (
GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
715 #ifdef ENABLE_LOGGING
729 #ifdef ENABLE_LOGGING
766 super.ReadFromContext(ctx);
768 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
772 super.WriteToContext(ctx);
774 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
824 case WeaponEvents.CHANGE_HIDE:
return new HandAnimEventChanged(p, src);
825 case WeaponEvents.CHANGE_SHOW:
return new HandAnimEventChanged(p, src);
832class HandEventHumanCommandActionFinished
extends HandEventBase
838class HandEventHumanCommandActionAborted
extends HandEventBase
void syncDebugPrint(string s)
InventoryValidationReason
eBleedingSourceType m_Type
Super root of all classes in Enforce script.
script counterpart to engine's class Inventory
const int c_InventoryReservationTimeoutShortMS
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 bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
static proto native bool CheckSwapItemsRequest(notnull Man requestingPlayer, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
static proto native bool CheckMoveToDstRequest(notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
static proto native bool CheckRequestSrc(notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
Abstracted event, not to be used, only inherited.
base class for transformation operations (creating one item from another)
Serialization general interface. Serializer API works with:
DayZPlayerInstanceType
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
EntityAI GetSecondSrcEntity()
InventoryLocation GetSrc()
ref InventoryLocation m_Src
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
void ReadFromContext(ParamsReadContext ctx)
bool CanPerformEventEx(InventoryValidation validation)
void WriteToContext(ParamsWriteContext ctx)
bool CheckRequestEx(InventoryValidation validation)
@ HUMANCOMMAND_ACTION_FINISHED
@ HUMANCOMMAND_ACTION_ABORTED
@ SWAP
swapping from ground
void HandEventBase(Man p=null, InventoryLocation src=null)
bool AcquireInventoryJunctureFromServer(notnull Man player)
InventoryLocation GetDst()
void ClearInventoryReservation()
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)
bool TryAcquireTwoInventoryJuncturesFromServer(notnull Man player, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)