DayZ 1.24
Loading...
Searching...
No Matches
HumanInventory Class Reference

inventory for plain man/human More...

Inheritance diagram for HumanInventory:
[legend]
Collaboration diagram for HumanInventory:
[legend]

Protected Member Functions

bool ReplaceItemInElsewhereWithNewinHandsImpl (InventoryMode mode, HandEventBase e)
 
bool ReplaceItemInHandsWithNewImpl (InventoryMode mode, HandEventBase e)
 
bool ReplaceItemInHandsWithNew (InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
 
bool ReplaceItemInHandsWithNewElsewhere (InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
 
bool SwappingToPreviousLocation (EntityAI item1, EntityAI item2, out InventoryLocation dst)
 
void HandleInventoryManipulation ()
 
void Update (float delta_time)
 
bool ValidateUserReservationCancel (inout Serializer ctx, InventoryValidation validation)
 

Private Member Functions

proto native EntityAI GetEntityInHands ()
 
proto native bool CanAddEntityInHands (EntityAI e)
 alternative for TestAddEntityInHands(e, true, true, true);
 
proto native bool TestAddEntityInHands (EntityAI e, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check)
 
proto native bool CanRemoveEntityInHands ()
 
proto native bool CanOpenInventory ()
 
proto native EntityAI CreateInHands (string typeName)
 creates new entity in hands
 
proto native int GetUserReservedLocationCount ()
 
proto native int FindUserReservedLocationIndex (notnull EntityAI e)
 
proto native int FindCollidingUserReservedLocationIndex (notnull EntityAI e, notnull InventoryLocation dst)
 
proto native void GetUserReservedLocation (int index, out notnull InventoryLocation dst)
 
proto native int FindFirstUserReservedLocationIndexForContainer (notnull EntityAI e)
 
proto native void SetUserReservedLocation (notnull EntityAI eai, notnull InventoryLocation dst)
 
proto native void ClearUserReservedLocation (notnull EntityAI eai)
 
proto native bool ClearUserReservedLocationAtIndex (int index)
 
proto native void ClearUserReservedLocationForContainer (notnull EntityAI eai)
 
proto native bool GetDebugFlag ()
 
override EntityAI CreateInInventory (string type)
 creates entity somewhere in inventory
 
void ClearUserReservedLocationSynced (notnull EntityAI eai)
 
void ClearUserReservedLocationAtIndexSynced (int index)
 
Man GetManOwner ()
 
bool HasEntityInHands (EntityAI e)
 
bool ProcessHandEvent (HandEventBase e)
 
void OnHandsStateChanged (HandStateBase src, HandStateBase dst)
 
void OnHandsExitedStableState (HandStateBase src, HandStateBase dst)
 
void OnHandsEnteredStableState (HandStateBase src, HandStateBase dst)
 
void OnEntityInHandsCreated (InventoryLocation src)
 
void OnEntityInHandsDestroyed (InventoryLocation src)
 
bool HandEvent (InventoryMode mode, HandEventBase e)
 
override bool DropEntity (InventoryMode mode, EntityAI owner, notnull EntityAI item)
 
bool ThrowEntity (EntityAI item, vector dir, float force)
 
bool RedirectToHandEvent (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
 
override bool TakeToDst (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
 
override bool TakeEntityToInventory (InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
 
override bool TakeEntityToCargoEx (InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
 Put item into into cargo on specific cargo location.
 
override bool TakeEntityAsAttachmentEx (InventoryMode mode, notnull EntityAI item, int slot)
 
override bool SwapEntities (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
 
override bool ForceSwapEntities (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
 
override bool LocalDestroyEntity (notnull EntityAI item)
 
override bool ReplaceItemWithNew (InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
 
bool ReplaceItemElsewhereWithNewInHands (InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
 
- Private Member Functions inherited from GameInventory
proto native bool GetCurrentInventoryLocation (out notnull InventoryLocation loc)
 returns information about current item location
 
proto native bool FindFreeLocationFor (notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
 FindFreeLocationFor.
 
proto native bool FindFreeLocationForEx (notnull EntityAI item, FindInventoryLocationType flags, notnull InventoryLocation exclude, out notnull InventoryLocation loc)
 FindFreeLocationForEx.
 
proto native bool FindFirstFreeLocationForNewEntity (string item_type, FindInventoryLocationType flags, out notnull InventoryLocation loc)
 FindFirstFreeLocationForNewEntity.
 
proto native int FindFreeLocationsFor (notnull EntityAI item, FindInventoryLocationType flags, out notnull array< ref InventoryLocation > locs)
 searches inventory for suitable location for @item
 
bool IsInCargo ()
 Returns true if this Inventory owner is in cargo of something.
 
bool IsAttachment ()
 Returns true if this Inventory owner is an attachment of something.
 
bool IsCargoInHiearchy ()
 Returns true if inventory owner or his hiearchy parents are in cargo.
 
bool GetCurrentAttachmentSlotInfo (out int slot_id, out string slot_name)
 Returns true if the item is currently attached and outputs attachment slot id and name.
 
proto native bool CanAddSwappedEntity (notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
 
void OnInventoryFailure (InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
 
bool TakeEntityToInventory (InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
 Put item anywhere into this entity (as attachment or into cargo, recursively)
 
bool TakeEntityToTargetInventory (InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
 helper that finds location first, then moves the entity into it
 
bool TakeToDst (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
 move src to dst
 
bool TakeEntityToCargo (InventoryMode mode, notnull EntityAI item)
 moves item to cargo of this intentory
 
bool TakeEntityToTargetCargo (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
 Put item into into cargo of another entity.
 
bool TakeEntityToCargoEx (InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
 moves item on specific cargo location
 
bool TakeEntityToTargetCargoEx (InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
 Put item into into cargo on specific cargo location of another entity.
 
bool TakeEntityAsAttachmentEx (InventoryMode mode, notnull EntityAI item, int slot)
 
bool TakeEntityAsTargetAttachmentEx (InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
 put item as attachment of target
 
bool TakeEntityAsAttachment (InventoryMode mode, notnull EntityAI item)
 
bool TakeEntityAsTargetAttachment (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
 
bool SwapEntities (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
 
bool ForceSwapEntities (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
 
bool DropEntity (InventoryMode mode, EntityAI owner, notnull EntityAI item)
 
bool DropEntityWithTransform (InventoryMode mode, EntityAI owner, notnull EntityAI item, vector transform[4])
 
bool DropEntityInBounds (InventoryMode mode, EntityAI owner, notnull EntityAI item, vector halfExtents, float angle, float cosAngle, float sinAngle)
 
bool LocalDestroyEntity (notnull EntityAI item)
 
bool ReplaceItemWithNew (InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
 
proto native bool GetFlipCargo ()
 
proto native void SetFlipCargo (bool flip)
 
proto native void FlipCargo ()
 
proto native void ResetFlipCargo ()
 
proto native EntityAI GetInventoryOwner ()
 Engine native functions.
 
proto native bool HasEntityInInventory (notnull EntityAI item)
 query inventory if item is somewhere
 
proto native bool EnumerateInventory (InventoryTraversalType tt, out array< EntityAI > items)
 enumerate inventory using traversal type and filling items array
 
proto native int CountInventory ()
 almost identical to EnumerateInventory except it does not return items
 
proto native CargoBase GetCargo ()
 cargo
 
proto native CargoBase GetCargoFromIndex (int index)
 
proto native EntityAI CreateEntityInCargo (string typeName)
 Create Entity of specified type in cargo of entity.
 
proto native EntityAI CreateEntityInCargoEx (string typeName, int idx, int row, int col, bool flip)
 Create Entity of specified type in cargo of entity at coordinates (row, col)
 
proto native bool HasEntityInCargo (notnull EntityAI e)
 
proto native bool HasEntityInCargoEx (notnull EntityAI e, int idx, int row, int col)
 
proto native bool CanAddEntityInCargo (notnull EntityAI e, bool flip)
 
proto native bool CanAddEntityInCargoEx (notnull EntityAI e, int idx, int row, int col, bool flip)
 
proto native bool CanAddEntityInCargoExLoc (InventoryLocation loc)
 
proto native bool TestAddEntityInCargoEx (notnull EntityAI e, int idx, int row, int col, bool flip, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
 
proto native bool TestAddEntityInCargoExLoc (notnull InventoryLocation loc, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
 
proto native bool CanRemoveEntityInCargo (notnull EntityAI e)
 
proto native bool CanRemoveEntityInCargoEx (notnull EntityAI e, int idx, int row, int col)
 
proto native int GetSlotId (int index)
 attachments
 
proto native int GetSlotIdCount ()
 
proto native int GetAttachmentSlotId (int index)
 
proto native int GetAttachmentSlotsCount ()
 
bool HasAttachmentSlot (int slotId)
 
proto native bool HasInventorySlot (int slotId)
 
proto native int AttachmentCount ()
 Returns count of attachments attached to this item.
 
proto native EntityAI CreateAttachment (string typeName)
 Create Entity of specified type as attachment of entity.
 
proto native EntityAI CreateAttachmentEx (string typeName, int slotId)
 Create Entity of specified type as attachment of entity.
 
proto native EntityAI GetAttachmentFromIndex (int index)
 
proto native EntityAI FindAttachment (int slot)
 Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
 
proto native EntityAI FindAttachmentByName (string slotName)
 Returns attached entity in slot (you can use EntityAI.GetActionComponentName to get slot id)
 
proto native bool HasAttachment (notnull EntityAI e)
 brief Returns True if entity is attached to this
 
proto native bool HasAttachmentEx (notnull EntityAI e, int slot)
 brief Returns True if entity is attached to this in slot
 
proto native bool CanAddAttachment (notnull EntityAI e)
 Check if attachment can be added to any slot.
 
proto native bool CanAddAttachmentEx (notnull EntityAI e, int slot)
 Check if attachment can be added to slot @NOTE: Note that slot index IS NOT slot ID! Slot ID is defined in DZ/data/config.cpp.
 
proto native bool CanRemoveAttachment (EntityAI attachment)
 
proto native bool CanRemoveAttachmentEx (EntityAI attachment, int slot)
 
proto native EntityAI FindPlaceholderForSlot (int slot)
 Returns placeholder entity for slot (naked arms, legs etc)
 
proto native bool IsPlaceholderEntity (notnull Object e)
 
proto native bool CanLockInventoryWithKey (notnull EntityAI key)
 locks
 
proto native bool CanUnlockInventoryWithKey (notnull EntityAI key)
 
proto native void LockInventoryWithKey (notnull EntityAI key)
 
proto native void UnlockInventoryWithKey (notnull EntityAI key)
 
proto native bool HasKeys ()
 
proto native void LockInventory (int lockType)
 
proto native void UnlockInventory (int lockType)
 
proto native int GetScriptLockCount ()
 
proto native bool IsInventoryUnlocked ()
 
proto native bool IsInventoryLocked ()
 
proto native bool IsInventoryLockedForLockType (int lockType)
 
proto native bool SetSlotLock (int slot, bool locked)
 
proto native bool GetSlotLock (int slot)
 
void Init ()
 script functions
 
bool OnStoreLoad (ParamsReadContext ctx, int version)
 db load hooks
 
void OnAfterStoreLoad ()
 
void OnStoreSave (ParamsWriteContext ctx)
 db store hook
 
void EEInit ()
 
void EEDelete (EntityAI parent)
 
EntityAI CreateInInventory (string type)
 creates entity somewhere in inventory
 
bool CanAddEntityToInventory (notnull EntityAI item, int flag=FindInventoryLocationType.ANY)
 ask inventory if item could be placed somewhere in inventory
 
bool AddEntityToInventory (notnull EntityAI item)
 add entity somewhere in inventory
 
bool CanRemoveEntity ()
 Returns if entity can be removed from its current location.
 
bool CanAddEntityInto (notnull EntityAI item, FindInventoryLocationType flags=FindInventoryLocationType.ANY)
 Asks inventory if item could be placed in inventory, hands, etc.
 
bool CanAddEntityIntoInventory (notnull EntityAI item)
 Test if entity can be put to the inventory (Cargo, ProxyCargo, Attachment)
 
bool CanAddEntityIntoHands (notnull EntityAI item)
 Test if entity can be put into hands.
 
bool OnInputUserDataProcess (ParamsReadContext ctx)
 synchronization
 
bool OnInventoryJunctureFromServer (ParamsReadContext ctx)
 
bool OnInventoryJunctureRepairFromServer (ParamsReadContext ctx)
 
void OnInventoryJunctureFailureFromServer (ParamsReadContext ctx)
 
void OnServerInventoryCommand (ParamsReadContext ctx)
 
bool AddInventoryReservationEx (EntityAI item, InventoryLocation dst, int timeout_ms)
 
bool ExtendInventoryReservationEx (EntityAI item, InventoryLocation dst, int timeout_ms)
 
bool ClearInventoryReservationEx (EntityAI item, InventoryLocation dst)
 
proto native int GetAnyInventoryReservationCount ()
 

Private Attributes

int m_syncClearUserReservationindex = -1
 
- Private Attributes inherited from GameInventory
const int c_InventoryReservationTimeoutMS = 5000
 reservations
 
const int c_InventoryReservationTimeoutShortMS = 3000
 
const float c_MaxItemDistanceRadius = 2.5
 anti-cheats
 

Additional Inherited Members

- Static Private Member Functions inherited from GameInventory
static proto native EntityAI LocationCreateEntity (notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
 creates new item directly at location
 
static proto native EntityAI LocationCreateLocalEntity (notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
 creates new local item directly at location @NOTE: the item is created localy, i.e. it's not registered to network
 
static proto native bool LocationCanAddEntity (notnull InventoryLocation inv_loc)
 queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/...
 
static bool LocationCanAddEntityEx (notnull InventoryLocation inv_loc)
 
static proto native bool LocationTestAddEntity (notnull InventoryLocation inv_loc, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
 test if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/...
 
static proto native bool LocationCanRemoveEntity (notnull InventoryLocation inv_loc)
 queries if the entity contained in inv_loc.m_item can be removed from ground/attachment/cargo/hands/...
 
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 shorthand for CanRemove + CanAdd query
 
static int GetInventoryCheckContext ()
 
static bool LocationCanMoveEntitySyncCheck (notnull InventoryLocation src, notnull InventoryLocation dst)
 
static proto native EntityAI LocationGetEntity (notnull InventoryLocation inv_loc)
 
static void OnServerInventoryCommandStatic (ParamsReadContext ctx)
 
static proto native bool LocationAddEntity (notnull InventoryLocation inv_loc)
 adds item to inventory location
 
static proto native bool LocationRemoveEntity (notnull InventoryLocation inv_loc)
 removes item from inventory location
 
static proto native bool LocationMoveEntity (notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
 removes item from current inventory location and adds it to destination
 
static proto native bool LocationSyncMoveEntity (notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
 synchronously removes item from current inventory location and adds it to destination no anims involved
 
static proto native bool LocationSwap (notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
 swaps two entities
 
static proto native bool ServerLocationMoveEntity (notnull EntityAI item, ParamsWriteContext ctx)
 removes item from current inventory location and adds it to destination + sync via inventory command
 
static proto native bool ServerLocationSyncMoveEntity (Man player, notnull EntityAI item, ParamsWriteContext ctx)
 synchronously removes item from current inventory location and adds it to destination + sync via inventory command no anims involved
 
static proto native bool ServerLocationSwap (notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, ParamsWriteContext ctx)
 swaps two entities
 
static proto native bool ServerHandEvent (notnull Man player, notnull EntityAI item, ParamsWriteContext ctx)
 hand event to clients
 
static proto native bool PrepareDropEntityPos (EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
 Finds a transformation for the item to be dropped to If the initial transforation overlaps with another conflicting entity (i.e. car) then the transform will be snapped to the nearest outer edge. If no valid snapping transformation could be found, then the output from 'PlaceOnSurface' is used.
 
static proto native bool TestDropEntityPos (EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
 
static proto native bool CanSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
 test if ordinary swap can be performed.
 
static bool CanSwapEntitiesEx (notnull EntityAI item1, notnull EntityAI item2)
 
static proto native bool CanForceSwapEntities (notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
 test if forced swap can be performed.
 
static bool CanForceSwapEntitiesEx (notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
 
static bool MakeDstForSwap (notnull InventoryLocation src1, notnull InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
 helper function for swap
 
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
 
static bool SetGroundPosByOwner (EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
 
static bool SetGroundPosByTransform (EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector transform[4])
 
static void SetGroundPosByOwnerBounds (EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector halfExtents, float angle, float cosAngle, float sinAngle)
 
static proto native bool AddInventoryReservation (EntityAI item, InventoryLocation dst, int timeout_ms)
 
static proto native bool ExtendInventoryReservation (EntityAI item, InventoryLocation dst, int timeout_ms)
 
static proto native bool ClearInventoryReservation (EntityAI item, InventoryLocation dst)
 
static proto native bool HasInventoryReservation (EntityAI item, InventoryLocation dst)
 Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY, FindInventoryReservationMode.LEGACY)
 
static proto native bool HasInventoryReservationCanAdd (EntityAI item, InventoryLocation dst)
 Internally: !HasInventoryReservationEx(item, dst, FindInventoryReservationMode.ITEM, FindInventoryReservationMode.DST)
 
static proto native bool HasInventoryReservationEx (EntityAI item, InventoryLocation dst, FindInventoryReservationMode itemMode, FindInventoryReservationMode parentMode)
 itemMode will iterate over item reservations, parentMode will iterate over parent reservations
 
static proto native bool GetInventoryReservationCount (EntityAI item, InventoryLocation dst)
 
static proto native bool CheckRequestSrc (notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
 
static proto native bool CheckDropRequest (notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
 
static proto native bool CheckTakeItemRequest (notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
 
static proto native bool CheckMoveToDstRequest (notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
 
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 CheckManipulatedObjectsDistances (notnull EntityAI e0, notnull EntityAI e1, float radius)
 
- Static Private Attributes inherited from GameInventory
static int m_inventory_check_context = InventoryCheckContext.DEFAULT
 

Detailed Description

inventory for plain man/human

HumanInventory has simple synchronous operations only, i.e. no animations are involved while adding/removing/swapping to/from hands.

Animations are added on higher level of hierarchy (DayZPlayerInventory for example)

Definition at line 9 of file HumanInventory.c.

Member Function Documentation

◆ CanAddEntityInHands()

HumanInventory::CanAddEntityInHands ( EntityAI e)
private

alternative for TestAddEntityInHands(e, true, true, true);

◆ CanOpenInventory()

proto native bool HumanInventory::CanOpenInventory ( )
private

◆ CanRemoveEntityInHands()

HumanInventory::CanRemoveEntityInHands ( )
private
Returns
true if entity can be removed from hands

◆ ClearUserReservedLocation()

proto native void HumanInventory::ClearUserReservedLocation ( notnull EntityAI eai)
private

◆ ClearUserReservedLocationAtIndex()

proto native bool HumanInventory::ClearUserReservedLocationAtIndex ( int index)
private

◆ ClearUserReservedLocationAtIndexSynced()

void HumanInventory::ClearUserReservedLocationAtIndexSynced ( int index)
inlineprivate

Definition at line 85 of file HumanInventory.c.

86 {
87 if (GetGame().IsClient())
89 else if (!GetGame().IsMultiplayer())
90 {
92
94
96 EntityAI item = il.GetItem();
97 item.GetOnReleaseLock().Invoke(item);
98 }
99
100 }
int m_syncClearUserReservationindex
proto native void GetUserReservedLocation(int index, out notnull InventoryLocation dst)
proto native bool ClearUserReservedLocationAtIndex(int index)
InventoryLocation.
proto native CGame GetGame()

References ClearUserReservedLocationAtIndex(), GetGame(), GetUserReservedLocation(), and m_syncClearUserReservationindex.

◆ ClearUserReservedLocationForContainer()

proto native void HumanInventory::ClearUserReservedLocationForContainer ( notnull EntityAI eai)
private

◆ ClearUserReservedLocationSynced()

void HumanInventory::ClearUserReservedLocationSynced ( notnull EntityAI eai)
inlineprivate

Definition at line 73 of file HumanInventory.c.

74 {
75 if (GetGame().IsClient())
77 else if (!GetGame().IsMultiplayer())
78 {
80 eai.GetOnReleaseLock().Invoke(eai);
81 }
82
83 }
proto native void ClearUserReservedLocation(notnull EntityAI eai)
proto native int FindUserReservedLocationIndex(notnull EntityAI e)

References ClearUserReservedLocation(), FindUserReservedLocationIndex(), GetGame(), and m_syncClearUserReservationindex.

◆ CreateInHands()

HumanInventory::CreateInHands ( string typeName)
private

creates new entity in hands

Parameters
[in]typeNametype name of the entity to be created
Returns
new entity or null otherwise

Referenced by CreateInInventory(), CTObjectFollower::SetHandsItem(), and ActionUncoverHeadBase::UncoverHead().

◆ CreateInInventory()

HumanInventory::CreateInInventory ( string type)
inlineprivate

creates entity somewhere in inventory

Parameters
[in]typeitem type to be placed in inventory
Returns
created entity

Definition at line 65 of file HumanInventory.c.

66 {
67 EntityAI newEntity = super.CreateInInventory(type);
68 if (newEntity == null)
70 return newEntity;
71 }
proto native EntityAI CreateInHands(string typeName)
creates new entity in hands

References CreateInHands().

◆ DropEntity()

override bool HumanInventory::DropEntity ( InventoryMode mode,
EntityAI owner,
notnull EntityAI item )
inlineprivate

Definition at line 139 of file HumanInventory.c.

140 {
142 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
143 {
144 switch (src.GetType())
145 {
146 case InventoryLocationType.HANDS:
147 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::DropEntity(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
148 HandEvent(mode, new HandEventDrop(GetManOwner(), src));
149 return true;
150
151 default:
152 return super.DropEntity(mode, owner, item);
153 }
154 }
155
156 Error("No inventory location");
157 return false;
158 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
void hndDebugPrint(string s)
Definition HandFSM.c:1
InventoryLocationType
types of Inventory Location
bool HandEvent(InventoryMode mode, HandEventBase e)
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:749
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References Error(), GetManOwner(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by EntityAI::DropEntityImpl(), and ThrowEntity().

◆ FindCollidingUserReservedLocationIndex()

proto native int HumanInventory::FindCollidingUserReservedLocationIndex ( notnull EntityAI e,
notnull InventoryLocation dst )
private

◆ FindFirstUserReservedLocationIndexForContainer()

proto native int HumanInventory::FindFirstUserReservedLocationIndexForContainer ( notnull EntityAI e)
private

◆ FindUserReservedLocationIndex()

proto native int HumanInventory::FindUserReservedLocationIndex ( notnull EntityAI e)
private

◆ ForceSwapEntities()

override bool HumanInventory::ForceSwapEntities ( InventoryMode mode,
notnull EntityAI item1,
notnull EntityAI item2,
notnull InventoryLocation item2_dst )
inlineprivate

returns item to previous location, if available

Definition at line 368 of file HumanInventory.c.

369 {
372 {
374
375 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
376 bool handled = false;
377 switch (src1.GetType())
378 {
379 case InventoryLocationType.HANDS:
381 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
382 e.ReserveInventory();
383 HandEvent(mode, e);
384 handled = true;
385 break;
386
387 }
388
389 switch (src2.GetType())
390 {
391 case InventoryLocationType.HANDS:
395 {
397 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
398 }
399 else
400 {
402 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
403 }
404
405 handled = true;
406 break;
407 }
408
409 bool returnValue = true;
410
411 if (!handled)
412 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
413
414 return returnValue;
415 }
416
417 Error("HumanInventory::ForceSwapEntities: No inventory location");
418 return false;
419 }
script counterpart to engine's class Inventory
Definition Inventory.c:79
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
Definition Inventory.c:1178
Abstracted event, not to be used, only inherited.
bool SwappingToPreviousLocation(EntityAI item1, EntityAI item2, out InventoryLocation dst)
static string DumpToStringNullSafe(InventoryLocation loc)

References InventoryLocation::DumpToStringNullSafe(), Error(), GetManOwner(), HandEvent(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), GameInventory::MakeSrcAndDstForForceSwap(), and SwappingToPreviousLocation().

Referenced by EntityAI::ForceSwapEntitiesImpl().

◆ GetDebugFlag()

proto native bool HumanInventory::GetDebugFlag ( )
private

◆ GetEntityInHands()

◆ GetManOwner()

◆ GetUserReservedLocation()

proto native void HumanInventory::GetUserReservedLocation ( int index,
out notnull InventoryLocation dst )
private

◆ GetUserReservedLocationCount()

proto native int HumanInventory::GetUserReservedLocationCount ( )
private

◆ HandEvent()

◆ HandleInventoryManipulation()

void HumanInventory::HandleInventoryManipulation ( )
protected

Referenced by Update().

◆ HasEntityInHands()

bool HumanInventory::HasEntityInHands ( EntityAI e)
inlineprivate

Definition at line 107 of file HumanInventory.c.

108 {
109 return e == GetEntityInHands();
110 }
proto native EntityAI GetEntityInHands()

References GetEntityInHands().

◆ LocalDestroyEntity()

override bool HumanInventory::LocalDestroyEntity ( notnull EntityAI item)
inlineprivate

Definition at line 421 of file HumanInventory.c.

422 {
424 if (item.GetInventory().GetCurrentInventoryLocation(src))
425 {
426 switch (src.GetType())
427 {
428 case InventoryLocationType.HANDS:
429 if (GetInventoryOwner().IsAlive())
430 {
431 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::LocalDestroy inv item=" + item);
432 HandEvent(InventoryMode.LOCAL, new HandEventDestroy(GetManOwner(), src));
433 return true;
434 }
435
436 return super.LocalDestroyEntity(item);
437
438 default:
439 return super.LocalDestroyEntity(item);
440 }
441 }
442
443 Error("LocalDestroyEntity: No inventory location");
444 return false;
445 }

References Error(), GameInventory::GetInventoryOwner(), GetManOwner(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by EntityAI::LocalDestroyEntityInHands(), and CTObjectFollower::SetHandsItem().

◆ OnEntityInHandsCreated()

void HumanInventory::OnEntityInHandsCreated ( InventoryLocation src)
inlineprivate

Definition at line 118 of file HumanInventory.c.

119 {
121 cpy.Copy(src);
122 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] OnEntityInHandsCreated src=" + InventoryLocation.DumpToStringNullSafe(cpy));
123 ProcessHandEvent(new HandEventCreated(GetManOwner(), src));
124 }
bool ProcessHandEvent(HandEventBase e)

References InventoryLocation::DumpToStringNullSafe(), GetManOwner(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and ProcessHandEvent().

◆ OnEntityInHandsDestroyed()

void HumanInventory::OnEntityInHandsDestroyed ( InventoryLocation src)
inlineprivate

◆ OnHandsEnteredStableState()

void HumanInventory::OnHandsEnteredStableState ( HandStateBase src,
HandStateBase dst )
private

◆ OnHandsExitedStableState()

void HumanInventory::OnHandsExitedStableState ( HandStateBase src,
HandStateBase dst )
private

◆ OnHandsStateChanged()

void HumanInventory::OnHandsStateChanged ( HandStateBase src,
HandStateBase dst )
private

◆ ProcessHandEvent()

bool HumanInventory::ProcessHandEvent ( HandEventBase e)
private

◆ RedirectToHandEvent()

bool HumanInventory::RedirectToHandEvent ( InventoryMode mode,
notnull InventoryLocation src,
notnull InventoryLocation dst )
inlineprivate

Definition at line 192 of file HumanInventory.c.

193 {
194 if (src.GetType() == InventoryLocationType.HANDS)
195 {
196 Man man_src = Man.Cast(src.GetParent());
197 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HI::RedirectToHandEvent - source location == HANDS, player has to handle this");
198
199 EntityAI item = src.GetItem();
200
202
203 if (r_index >= 0)
204 {
207
209 int r_type = r_il.GetType();
210 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
211 r_il.GetParent().GetOnReleaseLock().Invoke(item);
212 else if (r_type == InventoryLocationType.ATTACHMENT)
213 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(item, r_il.GetSlot());
214 }
215
216 man_src.GetHumanInventory().HandEvent(mode, new HandEventMoveTo(man_src, src, dst));
217 return true;
218 }
219
220 if (dst.GetType() == InventoryLocationType.HANDS)
221 {
222 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HI::RedirectToHandEvent - dst location == HANDS, player has to handle this");
223
224 Man man_dst = Man.Cast(dst.GetParent());
225 man_dst.GetHumanInventory().HandEvent(mode, new HandEventTake(man_dst, src));
226 return true;
227 }
228 return false;
229 }

References ClearUserReservedLocationAtIndex(), FindUserReservedLocationIndex(), GetUserReservedLocation(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by TakeEntityToInventory(), and TakeToDst().

◆ ReplaceItemElsewhereWithNewInHands()

bool HumanInventory::ReplaceItemElsewhereWithNewInHands ( InventoryMode mode,
ReplaceItemWithNewLambdaBase lambda )
inlineprivate

Definition at line 456 of file HumanInventory.c.

457 {
458 return ReplaceItemInElsewhereWithNewinHandsImpl(mode, new HandEventDestroyElsewhereAndReplaceWithNewInHands(GetManOwner(), null, lambda));
459 }
bool ReplaceItemInElsewhereWithNewinHandsImpl(InventoryMode mode, HandEventBase e)

References GetManOwner(), and ReplaceItemInElsewhereWithNewinHandsImpl().

Referenced by EntityAI::ReplaceItemElsewhereWithNewInHandsImpl().

◆ ReplaceItemInElsewhereWithNewinHandsImpl()

bool HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl ( InventoryMode mode,
HandEventBase e )
inlineprotected

Definition at line 461 of file HumanInventory.c.

462 {
463 if (GetEntityInHands())
464 {
465 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl Item in hands, event=" + e.DumpToString());
466 return false;
467 }
468
469 InventoryLocation dst = e.GetDst();
470 if (dst)
471 {
472 switch (dst.GetType())
473 {
474 case InventoryLocationType.HANDS:
475 if (GetInventoryOwner().IsAlive())
476 {
477 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl event=" + e);
478 HandEvent(mode, e);
479 return true;
480 }
481
482 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl DEAD_owner=" + GetInventoryOwner().GetName() + "=" + GetInventoryOwner());
483 Error("HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl TODO"); // replace-with-new in corpse's hands, not implemented
484 return false;
485
486 default:
487 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl src has to be hands");
488 return false;
489 }
490 }
491
492 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl no dst in event, event=" + e.DumpToString());
493 return false;
494 }
proto native owned string GetName()

References Error(), GetEntityInHands(), GameInventory::GetInventoryOwner(), GetName(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by ReplaceItemElsewhereWithNewInHands().

◆ ReplaceItemInHandsWithNew()

bool HumanInventory::ReplaceItemInHandsWithNew ( InventoryMode mode,
ReplaceItemWithNewLambdaBase lambda )
inlineprotected

◆ ReplaceItemInHandsWithNewElsewhere()

bool HumanInventory::ReplaceItemInHandsWithNewElsewhere ( InventoryMode mode,
ReplaceItemWithNewLambdaBase lambda )
inlineprotected

Definition at line 531 of file HumanInventory.c.

532 {
533 return ReplaceItemInHandsWithNewImpl(mode, new HandEventDestroyAndReplaceWithNewElsewhere(GetManOwner(), null, lambda));
534 }

References GetManOwner(), and ReplaceItemInHandsWithNewImpl().

Referenced by EntityAI::ReplaceItemInHandsWithNewElsewhereImpl().

◆ ReplaceItemInHandsWithNewImpl()

bool HumanInventory::ReplaceItemInHandsWithNewImpl ( InventoryMode mode,
HandEventBase e )
inlineprotected

Definition at line 496 of file HumanInventory.c.

497 {
500 if (itemInHands && itemInHands.GetInventory().GetCurrentInventoryLocation(src))
501 {
502 switch (src.GetType())
503 {
504 case InventoryLocationType.HANDS:
505 if ((mode != InventoryMode.SERVER) && GetInventoryOwner().IsAlive())
506 {
507 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl event=" + e);
508 HandEvent(mode, e);
509 return true;
510 }
511
512 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl DEAD_owner=" + GetInventoryOwner().GetName() + "=" + GetInventoryOwner());
513 HandEvent(mode, e);
514 return true;
515
516 default:
517 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl src has to be hands");
518 return false;
519 }
520 }
521
522 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl No item in hands, event=" + e.DumpToString());
523 return false;
524 }

References Error(), GetEntityInHands(), GameInventory::GetInventoryOwner(), GetName(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by ReplaceItemInHandsWithNew(), and ReplaceItemInHandsWithNewElsewhere().

◆ ReplaceItemWithNew()

override bool HumanInventory::ReplaceItemWithNew ( InventoryMode mode,
ReplaceItemWithNewLambdaBase lambda )
inlineprivate

Definition at line 447 of file HumanInventory.c.

448 {
450 if (itemInHands == lambda.m_OldItem)
452
453 return super.ReplaceItemWithNew(mode, lambda);
454 }
bool ReplaceItemInHandsWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)

References GetEntityInHands(), and ReplaceItemInHandsWithNew().

Referenced by EntityAI::ReplaceItemWithNewImpl().

◆ SetUserReservedLocation()

proto native void HumanInventory::SetUserReservedLocation ( notnull EntityAI eai,
notnull InventoryLocation dst )
private

◆ SwapEntities()

override bool HumanInventory::SwapEntities ( InventoryMode mode,
notnull EntityAI item1,
notnull EntityAI item2 )
inlineprivate

returns item to previous location, if available

Definition at line 324 of file HumanInventory.c.

325 {
328 {
329 bool handled = false;
330 switch (src1.GetType())
331 {
332 case InventoryLocationType.HANDS:
336 {
337 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventForceSwap(" + typename.EnumToString(InventoryMode, mode) + ") IH=src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2));
338 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
339 }
340 else
341 {
342 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + "src2=" + InventoryLocation.DumpToStringNullSafe(src2));
344 }
345 handled = true;
346 break;
347 }
348
349 switch (src2.GetType())
350 {
351 case InventoryLocationType.HANDS:
352 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap2(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " IH=src2=" + InventoryLocation.DumpToStringNullSafe(src2));
354 handled = true;
355 break;
356 }
357
358 if (!handled)
359 return super.SwapEntities(mode, item1, item2);
360
361 return true;
362 }
363
364 Error("HumanInventory::SwapEntities: cannot create src1, src2, dst1, dst2");
365 return false;
366 }
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
Definition Inventory.c:1166

References InventoryLocation::DumpToStringNullSafe(), Error(), GetManOwner(), HandEvent(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), GameInventory::MakeSrcAndDstForSwap(), and SwappingToPreviousLocation().

Referenced by EntityAI::SwapEntitiesImpl().

◆ SwappingToPreviousLocation()

bool HumanInventory::SwappingToPreviousLocation ( EntityAI item1,
EntityAI item2,
out InventoryLocation dst )
inlineprotected

Definition at line 536 of file HumanInventory.c.

537 {
538 bool SwapToPrevious = true;
541 dst = new InventoryLocation();
542 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
543 {
544 if (item1.m_OldLocation && item1.m_OldLocation.IsValid() && !item1.m_OldLocation.CollidesWith(src2) && item1.m_OldLocation.GetParent() && item1.m_OldLocation.GetParent().GetHierarchyRootPlayer())
545 {
546 dst.Copy(item1.m_OldLocation);
547
548 int count = item1.GetInventory().GetSlotIdCount();
549 if (count > 0 && src2.GetType() == InventoryLocationType.ATTACHMENT) //item2 is currently attached somewhere
550 {
551 for (int i = 0; i < count; i++)
552 {
553 int slotID = item1.GetInventory().GetSlotId(i);
554 if (src2.GetSlot() == slotID) //can be attached into the same slot. And will be.
555 return false;
556 }
557 }
558
559 if (!item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation))
560 SwapToPrevious = false;
561
563 SwapToPrevious = false;
564
565 if (SwapToPrevious)
566 return true;
567 }
568 }
569
570 return false;
571 }
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:610

References GameInventory::CanSwapEntitiesEx().

Referenced by ForceSwapEntities(), and SwapEntities().

◆ TakeEntityAsAttachmentEx()

override bool HumanInventory::TakeEntityAsAttachmentEx ( InventoryMode mode,
notnull EntityAI item,
int slot )
inlineprivate

Definition at line 294 of file HumanInventory.c.

295 {
297 if (item.GetInventory().GetCurrentInventoryLocation(src))
298 {
299 switch (src.GetType())
300 {
301 case InventoryLocationType.HANDS:
302 if (GetInventoryOwner().IsAlive())
303 {
304 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " slot=" + slot);
307 dst.SetAttachment(src_entity, item, slot);
308
309 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
310 return true;
311 }
312
313 return super.TakeEntityAsAttachmentEx(mode, item, slot);
314
315 default:
316 return super.TakeEntityAsAttachmentEx(mode, item, slot);
317 }
318 }
319
320 Error("HumanInventory::TakeEntityAsAttachmentEx: No inventory location");
321 return false;
322 }

References Error(), GameInventory::GetInventoryOwner(), GetManOwner(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

Referenced by EntityAI::TakeEntityAsAttachmentExImpl().

◆ TakeEntityToCargoEx()

override bool HumanInventory::TakeEntityToCargoEx ( InventoryMode mode,
notnull EntityAI item,
int idx,
int row,
int col )
inlineprivate

Put item into into cargo on specific cargo location.

Definition at line 265 of file HumanInventory.c.

266 {
268 if (item.GetInventory().GetCurrentInventoryLocation(src))
269 {
270 switch (src.GetType())
271 {
272 case InventoryLocationType.HANDS:
273 if (GetInventoryOwner().IsAlive())
274 {
275 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " row=" + row + " col=" + col);
277 dst.SetCargo(GetInventoryOwner(), item, idx, row, col, item.GetInventory().GetFlipCargo());
278
279 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
280 return true;
281 }
282
283 return super.TakeEntityToCargoEx(mode, item, idx, row, col);
284
285 default:
286 return super.TakeEntityToCargoEx(mode, item, idx, row, col);
287 }
288 }
289
290 Error("HumanInventory::TakeEntityToCargoEx: No inventory location");
291 return false;
292 }

References Error(), GameInventory::GetInventoryOwner(), GetManOwner(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

◆ TakeEntityToInventory()

override bool HumanInventory::TakeEntityToInventory ( InventoryMode mode,
FindInventoryLocationType flags,
notnull EntityAI item )
inlineprivate

Definition at line 241 of file HumanInventory.c.

242 {
244 if (item.GetInventory().GetCurrentInventoryLocation(src))
245 {
247 if (FindFreeLocationFor(item, flags, dst))
248 {
250 return true;
251
252 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
253 return super.TakeEntityToInventory(mode, flags, item);
254 }
255 else
256 return false; // no room
257 }
258 Error("HumanInventory::TakeEntityToInventory: No inventory location");
259 return false;
260 }
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
bool RedirectToHandEvent(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)

References Error(), GameInventory::FindFreeLocationFor(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and RedirectToHandEvent().

Referenced by EntityAI::PredictiveMoveItemFromHandsToInventory(), and EntityAI::TakeEntityToInventoryImpl().

◆ TakeToDst()

override bool HumanInventory::TakeToDst ( InventoryMode mode,
notnull InventoryLocation src,
notnull InventoryLocation dst )
inlineprivate

Definition at line 231 of file HumanInventory.c.

232 {
234
235 if (GetManOwner().IsAlive() && RedirectToHandEvent(mode, src, dst))
236 return true;
237
238 return super.TakeToDst(mode, src, dst);
239 }

References InventoryLocation::DumpToStringNullSafe(), GetManOwner(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and RedirectToHandEvent().

Referenced by EntityAI::TakeEntityToHandsImpl(), and EntityAI::TakeToDstImpl().

◆ TestAddEntityInHands()

HumanInventory::TestAddEntityInHands ( EntityAI e,
bool do_resevation_check,
bool do_item_check,
bool do_lock_check,
bool do_occupancy_test,
bool do_script_check )
private
Parameters
[in]eentity to test for taking in hands
[in]do_item_checkdeny if entity is not InventoryItem
[in]do_occupancy_testdeny if there is item in hands already
[in]do_script_checkdeny if script conditions fail
Returns
true if item passed all tests

◆ ThrowEntity()

bool HumanInventory::ThrowEntity ( EntityAI item,
vector dir,
float force )
inlineprivate

Definition at line 160 of file HumanInventory.c.

161 {
162 if (GetGame().IsServer() && GetGame().IsMultiplayer())
163 return false;
164
165 DayZPlayer player = DayZPlayer.Cast(item.GetHierarchyRootPlayer());
167
168 if (player.NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), null))
169 invMode = InventoryMode.JUNCTURE;
170
172 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
173 {
174 switch (src.GetType())
175 {
176 case InventoryLocationType.HANDS:
177 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ThrowEntity item=" + item);
178 HandEventThrow throwEvent = new HandEventThrow(GetManOwner(), src);
179 throwEvent.SetForce(dir * force);
181 return true;
182
183 default:
185 return true;
186 }
187 }
188 Error("No inventory location");
189 return false;
190 }
override bool DropEntity(InventoryMode mode, EntityAI owner, notnull EntityAI item)

References DropEntity(), Error(), GetGame(), GetManOwner(), HandEvent(), hndDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

◆ Update()

◆ ValidateUserReservationCancel()

bool HumanInventory::ValidateUserReservationCancel ( inout Serializer ctx,
InventoryValidation validation )
inlineprotected

TODO(kumarjac): It returned true and claimed success before, is this correct?

Definition at line 596 of file HumanInventory.c.

597 {
598 validation.m_Result = InventoryValidationResult.SUCCESS;
599
600 int index = -1;
601 if (!ctx.Read(index))
602 {
604 return true;
605 }
606
608 //m_UserReservationToClear = index;
609
610 return true;
611 }
InventoryValidationResult
Definition Inventory.c:30

References ClearUserReservedLocationAtIndex().

Member Data Documentation

◆ m_syncClearUserReservationindex

int HumanInventory::m_syncClearUserReservationindex = -1
private

The documentation for this class was generated from the following file: