DIFF

class DayZPlayerInventory

DayZPlayerInventory › HumanInventoryWithFSM › HumanInventory › GameInventory

Constructors 1

void DayZPlayerInventory()

Constants 2

static const float INVENTORY_REPAIR_MAX_DISTANCE = 500.0

MAx distance for itme to be repair (without it it can be use for getting position from server)

Referenced by OnInventoryCheck()
static const int INVENTORY_REPAIR_MAX_ITEMS = 5

limmit number of items transfere duting repair.

Referenced by OnInventoryCheck()

Members 9

ref Timer m_DeferredWeaponTimer = new Timer
protected ref HandEventBase m_DeferredPostedHandEvent = NULL

deferred hand event

ref WeaponEventBase m_DeferredWeaponEvent = NULL

deferred weapon event

protected ref HandAnimatedTakingFromAtt m_Taking
Referenced by Init()
protected ref HandAnimatedMovingToAtt m_MovingTo
Referenced by Init()
protected ref HandAnimatedSwapping m_Swapping
Referenced by Init()
protected ref HandAnimatedForceSwapping m_FSwapping
Referenced by Init()
protected ref HandAnimatedForceSwapping_Inst m_FSwappingInst
Referenced by Init()

Methods 78

void CancelHandEvent()

cancels any handevents that will be executed this frame @NOTE: this is used in situations where the player performs an action that renders the event invalid exactly on the frame it will be executed

void PostWeaponEvent(WeaponEventBase e)

deferred weapon's fsm handling of events @NOTE: "post" stores the event for later use when ::CommandHandler is being run

override bool OnInventoryJunctureFromServer(ParamsReadContext ctx)

reaction to engine callback originates in: engine - DayZPlayer::OnSyncJuncture script - PlayerBase.OnSyncJuncture

override void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)

Function and setup is still messy due to the switch statement and relation with reading.

It could be cleaner if we used classes to handle each inventory command type, but that comes at a performance cost and will also probably require making a fair amount of changes elsewhere.

The downsides with this system right now: 1. It makes it hard to track what is written/read from the serializer 2. It makes this file very very large

The new changes at least remove the massive switch block and allow for all inventory commands to respond back to the client if something goes wrong

proto native void StoreJunctureData(ParamsReadContext ctx)

stores received input user data for later handling /aaa

override bool OnInputUserDataProcess(ParamsReadContext ctx)

reaction to engine callback originates in: engine - DayZPlayer::OnInputUserDataReceived script - DayZPlayerImplement.OnInputUserDataReceived

proto native void StoreInputUserData(ParamsReadContext ctx)

stores received input user data for later handling

override void OnServerInventoryCommand(ParamsReadContext ctx)

Juncture is only ever Server Req->Client Ack and Perform->Server Perform, never remote

bool ValidateSyncMove(inout Serializer ctx, InventoryValidation validation)

Juncture is only ever Server Req->Client Ack and Perform->Server Perform, never remote

Referenced by ProcessInputData()
bool ValidateSyncMoveServer(ParamsReadContext ctx, InventoryValidation validation)

Never end here, always return in send junture part MW Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync

bool ValidateHandEvent(inout Serializer ctx, InventoryValidation validation)
References HandEventBase.AcquireInventoryJunctureFromServer(), HandEventBase.CanPerformEventEx(), Class.Cast()
Show 55 more, CheckForRope(), HandEventBase.CheckRequestEx(), HandEventBase.CheckRequestSrc(), HandEventBase.ClearInventoryReservation(), InventoryLocation.Copy(), array.Count(), HandEventBase.CreateHandEventFromContext(), HandEventBase.DumpToString(), EnableMovableOverride(), typename.EnumToString(), Error(), GameInventory.GetCurrentInventoryLocation(), GameInventory.GetCurrentInventoryLocation(), GetDayZPlayerOwner(), Class.GetDebugName(), Object.GetDebugName(), HandEventBase.GetDst(), HandEventBase.GetEventID(), Man.GetHumanInventory(), DayZPlayer.GetInstanceType(), EntityAI.GetInventory(), EntityAI.GetInventory(), HumanInventory.GetManOwner(), GetPlugin(), HandEventBase.GetSecondDst(), HandEventBase.GetSecondSrc(), HandEventBase.GetSecondSrcEntity(), Entity.GetSimulationTimeStamp(), Entity.GetSimulationTimeStamp(), HandEventBase.GetSrc(), HandEventBase.GetSrcEntity(), HandEventBase.HandEventFactory(), CGame.HasInventoryJuncture(), array.Insert(), new InventoryLocation(), Debug.InventoryMoveLog(), PluginInventoryDebug.IsDesyncRepairEnable(), LogManager.IsInventoryMoveLogEnable(), HandEventBase.IsServerSideOnly(), LogManager.IsSyncLogEnable(), HumanInventory.ProcessHandEvent(), RemoveMovableOverride(), SendRepairToClientDst(), InventoryInputUserData.SendServerInventoryCheck(), InventoryInputUserData.SerializeHandEvent(), syncDebugPrint(), Class.ToString(), Class.ToString(), HandEventBase.m_IsJuncture, InventoryValidation.m_IsJuncture, HandEventBase.m_IsRemote, InventoryValidation.m_IsRemote, HandEventBase.m_Player, InventoryValidation.m_Reason, and InventoryValidation.m_Result
Referenced by ProcessInputData()
bool ValidateHandEventServer(inout Serializer ctx, InventoryValidation validation)

TODO(kumarjac): We should probably set the result to failure like so

bool ValidateSwap(inout Serializer ctx, InventoryValidation validation)

'HandEventBase.CheckRequestEx' updates failure reason

References GameInventory.AddInventoryReservationEx(), GameInventory.CanForceSwapEntitiesEx(), Class.Cast()
Show 60 more, GameInventory.ClearInventoryReservationEx(), CGame.ClearJunctureEx(), array.Count(), GameInventory.DumpInventoryDebug(), InventoryLocation.DumpToStringNullSafe(), EnableMovableOverride(), typename.EnumToString(), Error(), GameInventory.GetCurrentInventoryLocation(), GameInventory.GetCurrentInventoryLocation(), GetDayZPlayerOwner(), Object.GetDebugName(), DayZPlayer.GetInstanceType(), DayZPlayer.GetInstanceType(), EntityAI.GetInventory(), EntityAI.GetInventory(), HumanInventory.GetManOwner(), GetPlugin(), Entity.GetSimulationTimeStamp(), CGame.HasInventoryJuncture(), array.Insert(), new InventoryJunctureSwapValidation(), Debug.InventoryMoveLog(), PluginInventoryDebug.IsDesyncRepairEnable(), LogManager.IsInventoryMoveLogEnable(), LogManager.IsSyncLogEnable(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), GameInventory.LocationSwap(), GameInventory.LocationSyncMoveEntity(), PlayerCheckRequestSrc(), PlayerCheckSwapItemsRequest(), RemoveMovableOverride(), new ScriptInputUserData(), SendRepairToClientDst(), InventoryInputUserData.SendServerInventoryCheck(), InventoryInputUserData.SerializeSwap(), SwapCheckExclusionMaskLocal(), syncDebugPrint(), Class.ToString(), Class.ToString(), TryAcquireTwoInventoryJuncturesFromServer(), GameInventory.c_InventoryReservationTimeoutShortMS, GameInventory.c_MaxItemDistanceRadius, InventoryJunctureSwapValidation.m_Dst1, InventoryJunctureSwapValidation.m_Dst2, InventoryJunctureSwapValidation.m_DstItem1, InventoryJunctureSwapValidation.m_DstItem2, InventoryValidation.m_IsJuncture, InventoryValidation.m_IsRemote, InventoryValidation.m_Reason, InventoryValidation.m_Result, InventoryJunctureSwapValidation.m_SkippedSwap, InventoryJunctureSwapValidation.m_Src1, InventoryJunctureSwapValidation.m_Src2, InventoryJunctureSwapValidation.m_SrcItem1, InventoryJunctureSwapValidation.m_SrcItem2, and InventoryJunctureSwapValidation.m_Success
Referenced by ProcessInputData()
bool ValidateSwapServer(inout Serializer ctx, InventoryValidation validation)

Check whether the juncture for the related player and items has been acquired.

References GameInventory.CanForceSwapEntitiesEx(), Class.Cast(), CGame.ClearJunctureEx()
Show 50 more, array.Count(), GameInventory.DumpInventoryDebug(), InventoryLocation.DumpToStringNullSafe(), EnableMovableOverride(), typename.EnumToString(), Error(), GameInventory.GetCurrentInventoryLocation(), GameInventory.GetCurrentInventoryLocation(), GetDayZPlayerOwner(), Object.GetDebugName(), EntityAI.GetInventory(), EntityAI.GetInventory(), HumanInventory.GetManOwner(), GetPlugin(), Entity.GetSimulationTimeStamp(), array.Insert(), new InventoryJunctureSwapValidation(), new InventoryLocation(), Debug.InventoryMoveLog(), PluginInventoryDebug.IsDesyncRepairEnable(), LogManager.IsInventoryMoveLogEnable(), LogManager.IsSyncLogEnable(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), InventoryLocation.IsValid(), GameInventory.LocationSwap(), PlayerCheckRequestSrc(), PlayerCheckSwapItemsRequest(), RemoveMovableOverride(), new ScriptInputUserData(), SendRepairToClientDst(), InventoryInputUserData.SendServerInventoryCheck(), InventoryInputUserData.SerializeSwap(), syncDebugPrint(), Class.ToString(), Class.ToString(), TryAcquireTwoInventoryJuncturesFromServer(), GameInventory.c_MaxItemDistanceRadius, InventoryJunctureSwapValidation.m_Dst1, InventoryJunctureSwapValidation.m_Dst2, InventoryJunctureSwapValidation.m_DstItem1, InventoryJunctureSwapValidation.m_DstItem2, InventoryValidation.m_Reason, InventoryValidation.m_Result, InventoryJunctureSwapValidation.m_Src1, InventoryJunctureSwapValidation.m_Src2, InventoryJunctureSwapValidation.m_SrcItem1, InventoryJunctureSwapValidation.m_SrcItem2, and InventoryJunctureSwapValidation.m_Success
bool ExecuteInventoryCommandClient(ParamsReadContext ctx)

Serializer can be updated and re-written to when we may want to only correct the client instead of denying the inventory command

override bool PostDeferredEventTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)

Remote inputs are processed in sync juncture once performed on the server - this code below was executing the inventory command before the player simulation timeestamp for remotes which is illegal

Referenced by TakeToDst()
override bool PostDeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
override void NetSyncCurrentStateID(int id)

Engine callback - network synchronization of FSM's state. not intended to direct use.

override void OnAfterStoreLoad()

engine reaction to load from database originates in: engine - Person::BinLoad script - PlayerBase.OnAfterStoreLoad

void SyncDeferredEventToRemotes()

If singleplayer or the client is executing this

override bool OnInventoryCheck(int userDataType, ParamsReadContext ctx)

Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync