86 return m_Src.GetItem();
117 case HandEventID.DROP:
return new HandEventDrop(p, src);
118 case HandEventID.THROW:
return new HandEventThrow(p, src);
120 case HandEventID.FORCESWAP:
return new HandEventForceSwap(p, src);
125 case HandEventID.REPLACE2:
return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
126 case HandEventID.REPLACE3:
return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
132 Error(
"[hndfsm] HandEventFactory - unregistered hand event with id=" +
id);
139 if (!ctx.
Read(eventID))
141 Error(
"[hndfsm] CreateHandEventFromContext - cannot read eventID");
145 if (!ctx.
Read(player))
147 Error(
"[hndfsm] CreateHandEventFromContext - cannot read player");
154 if (!ctx.
Read(animID))
156 Error(
"[hndfsm] CreateHandEventFromContext - cannot read animID");
162 b.m_AnimationID = animID;
185 if (il && !
m_Player.GetHumanInventory().HasInventoryReservation(il.
GetItem(),il))
206 m_Player.GetHumanInventory().ClearInventoryReservationEx(il.
GetItem(), il);
247 #ifdef ENABLE_LOGGING
257 return super.CanPerformEventEx(validation);
268 Error(
"[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
283 m_Dst.ReadFromContext(ctx);
287 super.WriteToContext(ctx);
288 m_Dst.WriteToContext(ctx);
315 #ifdef ENABLE_LOGGING
334 Error(
"[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
357 #ifdef ENABLE_LOGGING
383 #ifdef ENABLE_LOGGING
394 #ifdef ENABLE_LOGGING
405 #ifdef ENABLE_LOGGING
424 Error(
"[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
444 super.ReadFromContext(ctx);
453 super.WriteToContext(ctx);
475 return super.CheckRequestEx(validation);
498 return super.CanPerformEventEx(validation);
517 entity.GetTransform(mat);
518 m_Dst.SetGround(entity, mat);
522 Error(
"[hndfsm] HandEventThrow src entity null!");
529 super.ReadFromContext(ctx);
545 super.WriteToContext(ctx);
547 m_Dst.WriteToContext(ctx);
578 super.ReadFromContext(ctx);
584 m_Src2.ReadFromContext(ctx);
585 m_Dst.ReadFromContext(ctx);
586 m_Dst2.ReadFromContext(ctx);
592 super.WriteToContext(ctx);
594 m_Src2.WriteToContext(ctx);
595 m_Dst.WriteToContext(ctx);
596 m_Dst2.WriteToContext(ctx);
647 #ifdef ENABLE_LOGGING
656 #ifdef ENABLE_LOGGING
674 #ifdef ENABLE_LOGGING
696 player.ForceStandUpForHeavyItemsSwap(
m_Src.GetItem(),
m_Src2.GetItem() );
731 if(
m_Src && m_Dst &&
m_Src.GetItem() != m_Dst.GetItem())
734 if(m_Src2 && m_Dst2 && m_Src2.GetItem() != m_Dst2.GetItem())
739 if (
GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
742 #ifdef ENABLE_LOGGING
756 #ifdef ENABLE_LOGGING
793 super.ReadFromContext(ctx);
795 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
799 super.WriteToContext(ctx);
801 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
851 case WeaponEvents.CHANGE_HIDE:
return new HandAnimEventChanged(p, src);
852 case WeaponEvents.CHANGE_SHOW:
return new HandAnimEventChanged(p, src);
859class HandEventHumanCommandActionFinished
extends HandEventBase
865class HandEventHumanCommandActionAborted
extends HandEventBase
void syncDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
InventoryValidationReason
@ UNKNOWN
24 - Any other error. Can be returned from any call.
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)
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)
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 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)
InventoryValidationReason m_Reason
static bool IsInventoryHFSMLogEnable()
static bool IsSyncLogEnable()
base class for transformation operations (creating one item from another)
proto bool Write(void value_out)
proto bool Read(void value_in)
DayZPlayerInstanceType
defined in C++
Serializer ParamsReadContext
Serializer ParamsWriteContext
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.
static HandEventBase HandEventFactory(HandEventID id, Man p=null, InventoryLocation src=null)
static HandEventBase CreateHandEventFromContext(ParamsReadContext ctx)
InventoryLocation GetSrc()
ref InventoryLocation m_Src
bool m_IsJuncture
For action guards. Although we can guarantee the item will exist for remotes and juncture,...
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
bool CheckRequestEx(InventoryValidation validation)
@ HUMANCOMMAND_ACTION_FINISHED
@ HUMANCOMMAND_ACTION_ABORTED
@ SWAP
swapping from ground
void HandEventBase(Man p=null, InventoryLocation src=null)
InventoryLocation GetDst()
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)