98 case HandEventID.DROP:
return new HandEventDrop(p, src);
99 case HandEventID.THROW:
return new HandEventThrow(p, src);
101 case HandEventID.FORCESWAP:
return new HandEventForceSwap(p, src);
106 case HandEventID.REPLACE2:
return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
107 case HandEventID.REPLACE3:
return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
113 Error(
"[hndfsm] HandEventFactory - unregistered hand event with id=" +
id);
120 if (!ctx.
Read(eventID))
122 Error(
"[hndfsm] CreateHandEventFromContext - cannot read eventID");
126 if (!ctx.
Read(player))
128 Error(
"[hndfsm] CreateHandEventFromContext - cannot read player");
135 if (!ctx.
Read(animID))
137 Error(
"[hndfsm] CreateHandEventFromContext - cannot read animID");
143 b.m_AnimationID = animID;
173 m_Player.GetHumanInventory().ClearInventoryReservationEx(dst.
GetItem(), dst);
229 Error(
"[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
244 m_Dst.ReadFromContext(ctx);
248 super.WriteToContext(ctx);
249 m_Dst.WriteToContext(ctx);
292 Error(
"[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
354 Error(
"[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
366 m_CanPerformDrop =
true;
371 super.ReadFromContext(ctx);
373 ctx.
Read(m_CanPerformDrop);
383 super.WriteToContext(ctx);
385 ctx.
Write(m_CanPerformDrop);
397 if (!m_CanPerformDrop)
403 return super.CheckRequestEx(validation);
408 if (!m_CanPerformDrop)
425 if (!m_CanPerformDrop)
432 return super.CanPerformEventEx(validation);
450 entity.GetTransform(mat);
451 m_Dst.SetGround(entity, mat);
455 Error(
"[hndfsm] HandEventThrow src entity null!");
462 super.ReadFromContext(ctx);
478 super.WriteToContext(ctx);
480 m_Dst.WriteToContext(ctx);
482 ctx.
Write(m_Force[0]);
483 ctx.
Write(m_Force[1]);
484 ctx.
Write(m_Force[2]);
499 int m_Animation2ID = -1;
511 super.ReadFromContext(ctx);
518 m_Dst.ReadFromContext(ctx);
519 m_Dst2.ReadFromContext(ctx);
520 ctx.
Read(m_Animation2ID);
525 super.WriteToContext(ctx);
527 m_Src2.WriteToContext(ctx);
528 m_Dst.WriteToContext(ctx);
529 m_Dst2.WriteToContext(ctx);
530 ctx.
Write(m_Animation2ID);
540 return m_Src2.GetItem();
569 else if (!
m_Player.GetHumanInventory().CanAddSwappedEntity(
m_Src, m_Src2, m_Dst, m_Dst2))
611 player.ForceStandUpForHeavyItemsSwap(
m_Src.
GetItem(), m_Src2.GetItem() );
622 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
630 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
631 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
643 if (
GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
697 super.ReadFromContext(ctx);
699 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
703 super.WriteToContext(ctx);
705 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
755 case WeaponEvents.CHANGE_HIDE:
return new HandAnimEventChanged(p, src);
756 case WeaponEvents.CHANGE_SHOW:
return new HandAnimEventChanged(p, src);
763class HandEventHumanCommandActionFinished
extends HandEventBase
769class HandEventHumanCommandActionAborted
extends HandEventBase
void syncDebugPrint(string s)
InventoryValidationReason
eBleedingSourceType m_Type
static HandEventBase HandEventFactory(HandEventID id, Man p=null, InventoryLocation src=null)
static HandEventBase CreateHandEventFromContext(ParamsReadContext ctx)
InventoryLocation GetSrc()
ref InventoryLocation m_Src
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
bool CanPerformEventEx(InventoryValidation validation)
bool CheckRequestEx(InventoryValidation validation)
@ HUMANCOMMAND_ACTION_FINISHED
@ HUMANCOMMAND_ACTION_ABORTED
@ SWAP
swapping from ground
InventoryLocation GetDst()
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)
bool TryAcquireTwoInventoryJuncturesFromServer(notnull Man player, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
Super root of all classes in Enforce script.
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
script counterpart to engine's class Inventory
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
const int c_InventoryReservationTimeoutShortMS
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
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)
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()
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
static bool IsInventoryHFSMLogEnable()
base class for transformation operations (creating one item from another)
Serialization general interface. Serializer API works with:
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.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.