116 return m_event.ReserveInventory();
121 m_event.ClearInventoryReservation();
183 CreateStableStates();
185 m_Taking =
new HandAnimatedTakingFromAtt(GetManOwner(),
null);
285 Error(
"[wpnfsm] " +
Object.GetDebugName(GetInventoryOwner()) +
" warning - pending event already posted, curr_event=" +
m_DeferredWeaponEvent.DumpToString() +
" new_event=" +
e.DumpToString());
293 string secondPart =
" - ENTITY IN HANDS IS NOT A WEAPON: " +
Object.GetDebugName(GetEntityInHands());
298 secondPart =
" on " +
Object.GetDebugName(GetEntityInHands()) +
" which is in state " +
weapon.GetCurrentState();
300 for (
int i = 0;
i <
weapon.GetMuzzleCount(); ++
i)
304 if (
i <
weapon.GetMuzzleCount() - 1)
322 weapon.GetCurrentState().OnUpdate(
dt);
347 if (
hcw.IsActionFinished())
349 if (
weapon.IsWaitingForActionFinish())
397 m_FSM.GetCurrentState().OnUpdate(
dt);
404 if (!m_FSM.GetCurrentState().IsIdle() || !m_FSM.IsRunning())
426 if (
hcw.IsActionFinished())
428 if (m_FSM.GetCurrentState().IsWaitingForActionFinish())
432 hndDebugPrint(
"[hndfsm] Hand-Weapon event: finished! notifying waiting state=" + m_FSM.GetCurrentState());
443 hndDebugPrint(
"[hndfsm] Hand-Weapon event: ABORT! notifying running state=" + m_FSM.GetCurrentState());
524 if (
GetGame().IsDedicatedServer())
753 LocationSyncMoveEntity(
src,
dst);
793 Error(
"[syncinv] HandleInputData: unexpected return code from AcquireInventoryJunctureFromServer");
827 LocationSyncMoveEntity(
src,
dst);
838 e.ClearInventoryReservation();
851 Debug.
InventoryMoveLog(
"STS = " +
e.m_Player.GetSimulationTimeStamp() +
" event= " +
e.DumpToString(),
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
860 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
863 Error(
"[syncinv] HandleInputData remote input (cmd=HAND_EVENT, event=" +
e.DumpToString() +
") dropped, item not in bubble");
881 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
900 Debug.
InventoryMoveLog(
"Failed - CheckRequest",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
922 Debug.
InventoryMoveLog(
"Failed - CanPerformEvent",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
931 syncDebugPrint(
"[desync] HandleInputData man=" +
Object.GetDebugName(GetManOwner()) +
" CANNOT do cmd=HAND_EVENT e=" +
e.DumpToString());
949 Debug.
InventoryMoveLog(
"Juncture not required",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
958 Debug.
InventoryMoveLog(
"Juncture sended",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
976 Debug.
InventoryMoveLog(
"Juncture denied",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
984 Error(
"[syncinv] HandleInputData: unexpected return code from AcquireInventoryJunctureFromServer");
996 Debug.
InventoryMoveLog(
"Success - ProcessHandEvent",
"HAND_EVENT",
"n/a",
"ProcessInputData",
e.m_Player.ToString());
1000 if (!
e.m_Player.GetHumanInventory().ProcessHandEvent(
e))
1056 Error(
"[syncinv] HandleInputData remote input (cmd=SWAP) dropped, item not in bubble");
1150 if (!(
src1.IsValid() &&
src2.IsValid() &&
dst1.IsValid() &&
dst2.IsValid()))
1193 Error(
"[syncinv] HandleInputData: unexpected return code from TryAcquireTwoInventoryJuncturesFromServer");
return true;
1236 src.ReadFromContext(
ctx);
1250 Error(
"[syncinv] HandleInputData remote input (cmd=DESTROY) dropped, item not in bubble");
1304 if (!
ctx.Read(type))
1367 Error(
"InventoryValidationResult.JUNCTURE returned when not possible to send!");
1381 itemIB.SetCanBeMovedOverride(
false);
1388 itemIB.SetCanBeMovedOverride(
true);
1422 if (GetManOwner().IsAlive() ==
false)
1483 LocationSyncMoveEntity(
src,
dst);
1571 Error(
"HandEvent - Invalid mode");
1663 Error(
"SwapEntities - HandEvent - Invalid mode");
1667 Error(
"SwapEntities - MakeSrcAndDstForSwap - no inv loc");
1762 Error(
"ForceSwapEntities - HandEvent - Invalid mode");
1771 if (
e.IsServerSideOnly())
1772 Error(
"[syncinv] " +
Object.GetDebugName(
player) +
" SendServerHandEventViaJuncture - called on server side event only, e=" +
e.DumpToString());
1778 if (
src.IsValid() &&
dst.IsValid())
1780 if (
player.NeedInventoryJunctureFromServer(
src.GetItem(),
src.GetParent(),
dst.GetParent()))
1812 Error(
"[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
1821 super.NetSyncCurrentStateID(
id);
1842 if (GetEntityInHands())
1852 pb.GetWeaponManager().SetRunning(
true);
1858 wpn.ProcessWeaponAbortEvent(
e);
1860 wpn.ProcessWeaponEvent(
e);
1861 pb.GetWeaponManager().SetRunning(
false);
1865 Error(
"OnEventForRemoteWeapon - entity in hands, but not weapon. item=" + GetEntityInHands());
1868 Error(
"OnEventForRemoteWeapon - no entity in hands");
1882 hndDebugSpam(
"[hndfsm] recv event from remote: created event=" +
e);
1886 if (
e.GetEventID() ==
HandEventID.HUMANCOMMAND_ACTION_ABORTED)
1889 m_FSM.ProcessAbortEvent(
e,
aa);
1892 m_FSM.ProcessEvent(
e);
1907 e.WriteToContext(
ctx);
1910 hndDebugPrint(
"[hndfsm] send 2 remote: sending e=" +
e +
" id=" +
e.GetEventID() +
" p=" +
p +
" e=" +
e.DumpToString());
1912 p.StoreInputForRemotes(
ctx);
1921 hndDebugPrint(
"[hndfsm] hand fsm exit stable src=" +
src.Type().ToString());
1929 hndDebugPrint(
"[hndfsm] hand fsm entered stable dst=" +
dst.Type().ToString());
1937 hndDebugPrint(
"[hndfsm] hand fsm changed state src=" +
src.Type().ToString() +
" ---> dst=" +
dst.Type().ToString());
2080 Error(
"HumanInventory::HandEvent - Invalid mode");
2087 super.HandleInventoryManipulation();
2154 result = CheckMoveToDstRequest(GetManOwner(),
src,
dst, radius);
2228 result = CheckDropRequest(GetManOwner(),
src, radius);
void syncDebugPrint(string s)
void inventoryDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
InventoryValidationResult
InventoryValidationReason
void wpnDebugSpamALot(string s)
void wpnDebugPrint(string s)
void ClearInventoryReservationEx(ActionData action_data)
override void OnAfterStoreLoad()
engine reaction to load from database originates in: engine - Person::BinLoad script - PlayerBase....
bool PlayerCheckDropRequest(notnull InventoryLocation src, float radius)
bool ValidateSyncMove(inout Serializer ctx, InventoryValidation validation)
bool ValidateHandEvent(inout Serializer ctx, InventoryValidation validation)
void EnableMovableOverride(EntityAI item)
void OnHandleStoredInputUserData(ParamsReadContext ctx)
bool ProcessInputData(ParamsReadContext ctx, bool isJuncture, bool isRemote)
ref HandAnimatedForceSwapping m_FSwapping
void HandleHandEvent(DeferredEvent deferred_event)
void HandleWeaponEvents(float dt, out bool exitIronSights)
proto native void StoreInputUserData(ParamsReadContext ctx)
void OnHandleStoredJunctureData(ParamsReadContext ctx)
void SyncHandEventToRemote(HandEventBase e)
void HandleTakeToDst(DeferredEvent deferred_event)
void DeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
ref HandAnimatedForceSwapping_Inst m_FSwappingInst
ref HandAnimatedSwapping m_Swapping
bool ValidateDestroy(inout Serializer ctx, InventoryValidation validation)
void CheckForRope(InventoryLocation src, InventoryLocation dst)
bool PlayerCheckRequestSrc(notnull InventoryLocation src, float radius)
override void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
void PostWeaponEvent(WeaponEventBase e)
override void NetSyncCurrentStateID(int id)
override void OnHandsEnteredStableState(HandStateBase src, HandStateBase dst)
bool IsServerOrLocalPlayer()
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
override void OnInventoryJunctureFailureFromServer(ParamsReadContext ctx)
void RemoveMovableOverride(EntityAI item)
ref HandEventBase m_DeferredPostedHandEvent
override void HandleInventoryManipulation()
override bool OnInventoryJunctureFromServer(ParamsReadContext ctx)
void DayZPlayerInventory()
ref HandAnimatedTakingFromAtt m_Taking
deferred weapon event
override bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
ref HandAnimatedMovingToAtt m_MovingTo
override bool OnInventoryJunctureRepairFromServer(ParamsReadContext ctx)
void DeferredTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
override void OnHandsExitedStableState(HandStateBase src, HandStateBase dst)
void CancelHandEvent()
cancels any handevents that will be executed this frame @NOTE: this is used in situations where the p...
override void OnHandsStateChanged(HandStateBase src, HandStateBase dst)
bool OnHandEventForRemote(ParamsReadContext ctx)
ref InventoryLocation m_dst1
ref WeaponEventBase m_DeferredWeaponEvent
deferred hand event
void OnInputUserDataForRemote(ParamsReadContext ctx)
DayZPlayer GetDayZPlayerOwner()
void DeferredHandEvent(InventoryMode mode, HandEventBase e)
override bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
bool ValidateSwap(inout Serializer ctx, InventoryValidation validation)
void HandleSwapEntities(DeferredEvent deferred_event)
bool PlayerCheckSwapItemsRequest(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
void HandleInventory(float dt)
void DeferredWeaponFailed()
ref InventoryLocation m_dst
void HandleForceSwapEntities(DeferredEvent deferred_event)
ref Timer m_DeferredWeaponTimer
bool PlayerCheckRequestDst(notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
bool OnEventForRemoteWeapon(ParamsReadContext ctx)
override void OnServerInventoryCommand(ParamsReadContext ctx)
proto native void StoreJunctureData(ParamsReadContext ctx)
ref InventoryLocation m_dst2
DeferredSwapEntities m_item1
override bool HandEvent(InventoryMode mode, HandEventBase e)
class DeferredEvent m_src
static void SendServerHandEventViaJuncture(notnull DayZPlayer player, HandEventBase e)
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
WeaponEventBase WeaponAnimEventFactory(WeaponEvents type, DayZPlayer p=NULL, Magazine m=NULL)
creates animation system events
WeaponEventBase CreateWeaponEventFromContext(ParamsReadContext ctx)
WeaponEventID
identifier for events. mainly for rpc purposes
void fsmDebugSpam(string s)
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
void ClearInventoryReservation()
void hndDebugSpam(string s)
void hndDebugSpamALot(string s)
void hndDebugPrint(string s)
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
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.
override void OnItemInHandsChanged()
static const int SJ_INVENTORY_FAILURE
static const int SJ_INVENTORY
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
bool ReserveInventory(HumanInventory inventory)
void ClearInventoryReservation(HumanInventory inventory)
override bool ReserveInventory(HumanInventory inventory)
ref HandEventBase m_event
void DeferredHandEvent(InventoryMode mode, HandEventBase e)
override void ClearInventoryReservation(HumanInventory inventory)
ref InventoryLocation m_dst1
void DeferredSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
override void ClearInventoryReservation(HumanInventory inventory)
override bool ReserveInventory(HumanInventory inventory)
ref InventoryLocation m_dst2
script counterpart to engine's class Inventory
const int c_InventoryReservationTimeoutShortMS
static bool MakeSrcAndDstForSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
static bool MakeSrcAndDstForForceSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, notnull InventoryLocation dst2)
helper function for ForceSwap
const int c_InventoryReservationTimeoutMS
reservations
static bool LocationCanMoveEntitySyncCheck(notnull InventoryLocation src, notnull InventoryLocation dst)
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 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...
Abstracted event, not to be used, only inherited.
represent hand state base
inventory for plain man/human
HumanInventory... with FSM (synchronous, no anims)
static string DumpToStringNullSafe(InventoryLocation loc)
static bool IsWeaponLogEnable()
static bool IsSyncLogEnable()
static bool IsInventoryHFSMLogEnable()
static bool IsInventoryMoveLogEnable()
Serialization general interface. Serializer API works with:
signalize mechanism manipulation
proto native void StoreInputForRemotes(ParamsWriteContext ctx)
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerInstanceType GetInstanceType()
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.
string WeaponActionTypeToString(int A, int AT)