Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс GameInventory

script counterpart to engine's class Inventory Подробнее...

+ Граф наследования: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 AreChildrenAccessible ()
 Returns true if item is considered reachable within inventory.
 
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)
 

Защищенные статические члены

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 int m_inventory_check_context = InventoryCheckContext.DEFAULT
 
const int c_InventoryReservationTimeoutMS = 5000
 reservations
 
const int c_InventoryReservationTimeoutShortMS = 3000
 
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 ()
 
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)
 
const float c_MaxItemDistanceRadius = 2.5
 anti-cheats
 
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)
 

Подробное описание

script counterpart to engine's class Inventory

Методы

◆ AddEntityToInventory()

AddEntityToInventory ( notnull EntityAI item)
inlineprotected

add entity somewhere in inventory

All available inventory locations (hands, cargo, attachments, proxycargo, ...) are traversed recursively from root to leafs.

@NOTE: AddEntityToInventory does not perform the checks the CanAddEntityToInventory does (script conditions for example). if not sure, always call CanAddEntityToInventory before AddEntityToInventory.

Аргументы
[in]itemitem to be placed in inventory
Возвращает
true if item can be added, false otherwise
926 {
929 if (result)
930 return LocationAddEntity(il);
931
932 return result;
933 }
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:16
static proto native bool LocationAddEntity(notnull InventoryLocation inv_loc)
adds item to inventory location
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
InventoryLocation.
Definition InventoryLocation.c:28
Definition EntityAI.c:95

Перекрестные ссылки FindFreeLocationFor() и LocationAddEntity().

◆ AddInventoryReservation()

static proto native bool AddInventoryReservation ( EntityAI item,
InventoryLocation dst,
int timeout_ms )
staticprotected

Используется в AddInventoryReservationEx().

◆ AddInventoryReservationEx()

bool AddInventoryReservationEx ( EntityAI item,
InventoryLocation dst,
int timeout_ms )
inlineprotected
718 {
719 if (GetGame().IsMultiplayer() && GetGame().IsServer() )
720 return true;
721
723 #ifdef DEVELOPER
725 {
726 DayZPlayer player = GetGame().GetPlayer();
727 if ( player )
728 {
729 if (item)
730 Debug.InventoryMoveLog("Reservation result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / " + item.ToString() + " / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "AddInventoryReservation", player.ToString() );
731 else
732 Debug.InventoryMoveLog("Reservation result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / null / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "AddInventoryReservation", player.ToString() );
733 }
734 }
735 #endif
736 return ret_val;
737 }
Definition DayZPlayerImplement.c:111
Definition Debug.c:14
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:172
static proto native bool AddInventoryReservation(EntityAI item, InventoryLocation dst, int timeout_ms)
static string DumpToStringNullSafe(InventoryLocation loc)
Definition InventoryLocation.c:218
Definition Debug.c:735
static bool IsInventoryReservationLogEnable()
Definition Debug.c:799
proto native CGame GetGame()

Перекрестные ссылки AddInventoryReservation(), InventoryLocation::DumpToStringNullSafe(), GetGame(), Debug::InventoryMoveLog() и LogManager::IsInventoryReservationLogEnable().

◆ AreChildrenAccessible()

bool AreChildrenAccessible ( )
inlineprotected

Returns true if item is considered reachable within inventory.

441 {
443 if (ent)
444 return ent.AreChildrenAccessible();
445
446 #ifdef DEVELOPER
447 ErrorEx("no inventory owner found!");
448 #endif
449
450 return true; //just in case inventoy without owner exists somewhere (shouldn't!)
451 }
Definition Building.c:6
proto native EntityAI GetInventoryOwner()
Engine native functions.
enum ShapeType ErrorEx

Перекрестные ссылки ErrorEx и GetInventoryOwner().

◆ AttachmentCount()

AttachmentCount ( )
protected

Returns count of attachments attached to this item.

◆ CanAddAttachment()

CanAddAttachment ( notnull EntityAI e)
protected

Check if attachment can be added to any slot.

Возвращает
true if entity can be added as attachment

◆ CanAddAttachmentEx()

CanAddAttachmentEx ( notnull EntityAI e,
int slot )
protected

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.

◆ CanAddEntityInCargo()

proto native bool CanAddEntityInCargo ( notnull EntityAI e,
bool flip )
protected

◆ CanAddEntityInCargoEx()

proto native bool CanAddEntityInCargoEx ( notnull EntityAI e,
int idx,
int row,
int col,
bool flip )
protected

◆ CanAddEntityInCargoExLoc()

proto native bool CanAddEntityInCargoExLoc ( InventoryLocation loc)
protected

◆ CanAddEntityInto()

CanAddEntityInto ( notnull EntityAI item,
FindInventoryLocationType flags = FindInventoryLocationType.ANY )
inlineprotected

Asks inventory if item could be placed in inventory, hands, etc.

Location is based on the flags parameter. This method is used in methods that are asking for if item can be placed in specific location, like CanAddEntityToInventory, CanAddEntityInHands, etc.

Аргументы
[in]itemitem to be placed in inventory
[in]flagsFindInventoryLocationType
Возвращает
true if item can be added, false otherwise
961 {
963 return FindFreeLocationFor(item, flags, loc) && !item.IsHologram();
964 }

Перекрестные ссылки FindFreeLocationFor().

Используется в CanAddEntityIntoHands() и CanAddEntityIntoInventory().

◆ CanAddEntityIntoHands()

bool CanAddEntityIntoHands ( notnull EntityAI item)
inlineprotected

Test if entity can be put into hands.

978 {
980 }
bool CanAddEntityInto(notnull EntityAI item, FindInventoryLocationType flags=FindInventoryLocationType.ANY)
Asks inventory if item could be placed in inventory, hands, etc.
Definition Inventory.c:960

Перекрестные ссылки CanAddEntityInto().

◆ CanAddEntityIntoInventory()

bool CanAddEntityIntoInventory ( notnull EntityAI item)
inlineprotected

Test if entity can be put to the inventory (Cargo, ProxyCargo, Attachment)

970 {
972 }

Перекрестные ссылки CanAddEntityInto().

◆ CanAddEntityToInventory()

CanAddEntityToInventory ( notnull EntityAI item,
int flag = FindInventoryLocationType.ANY )
inlineprotected

ask inventory if item could be placed somewhere in inventory

All available inventory locations (hands, cargo, attachments, proxycargo, ...) are traversed recursively from root to leafs.

Аргументы
[in]itemitem to be placed in inventory
Возвращает
true if item can be added, false otherwise
906 {
909 return result;
910 }

Перекрестные ссылки FindFreeLocationFor().

◆ CanAddSwappedEntity()

◆ CanForceSwapEntities()

CanForceSwapEntities ( notnull EntityAI item1,
InventoryLocation item1_dst,
notnull EntityAI item2,
out InventoryLocation item2_dst )
staticprotected

test if forced swap can be performed.

Аргументы
[in]item1is the forced item (primary)
[in]item1_dstoptional destination for item1 (null if item1 goes to place of item2)
[in]item2second item that will be replaced by the item1. (secondary)
[out]item2_dstsecond item's potential destination (if null, search for item_dst2 is ommited). if (NOT null AND IsValid()), then it is tried first, without search to inventory
Возвращает
true if can be force swapped

Используется в CanForceSwapEntitiesEx().

◆ CanForceSwapEntitiesEx()

static bool CanForceSwapEntitiesEx ( notnull EntityAI item1,
InventoryLocation item1_dst,
notnull EntityAI item2,
out InventoryLocation item2_dst )
inlinestaticprotected
666 {
668 return false;
669
670 int slot;
672
673 if (!item1.CanBeFSwaped())
674 return false;
675
676 if ( item1_dst == null)
677 {
678 item2.GetInventory().GetCurrentInventoryLocation(il);
679 slot = il.GetSlot();
680 }
681 else
682 {
683 slot = item1_dst.GetSlot();
684 }
685
686 if ( item1.GetQuantity() > item1.GetTargetQuantityMax(slot) )
687 return false;
688
689 if ( item2_dst == null)
690 {
691 item1.GetInventory().GetCurrentInventoryLocation(il);
692 slot = il.GetSlot();
693 }
694 else
695 {
696 slot = item2_dst.GetSlot();
697 }
698
699 if (!item1.CanSwapEntities(item2, item2_dst, item1_dst) || !item2.CanSwapEntities(item1, item1_dst, item2_dst))
700 {
701 return false;
702 }
703
704 if ( item2.GetQuantity() > item2.GetTargetQuantityMax(slot) )
705 return false;
706
707 return true;
708 }
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.

Перекрестные ссылки CanForceSwapEntities().

Используется в HandEventBase::CanPerformEvent(), HandEventSwap::CanPerformEvent(), WeaponManager::CanSwapMagazine(), LayoutHolder::CanSwapOrTakeToHandsEx(), Icon::DraggingOverSwap(), ItemManager::GetChosenCombinationFlag(), HandGuardBase::GuardCondition(), ManBase::OnQuickBarSingleUse(), WeaponManager::PrepareInventoryLocationForMagazineSwap(), Icon::Swap() и ValidateSwap().

◆ CanLockInventoryWithKey()

proto native bool CanLockInventoryWithKey ( notnull EntityAI key)
protected

locks

◆ CanRemoveAttachment()

proto native bool CanRemoveAttachment ( EntityAI attachment)
protected

◆ CanRemoveAttachmentEx()

proto native bool CanRemoveAttachmentEx ( EntityAI attachment,
int slot )
protected

◆ CanRemoveEntity()

bool CanRemoveEntity ( )
inlineprotected

Returns if entity can be removed from its current location.

939 {
943
944 return false;
945 }
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
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/....

Перекрестные ссылки GetCurrentInventoryLocation() и LocationCanRemoveEntity().

◆ CanRemoveEntityInCargo()

proto native bool CanRemoveEntityInCargo ( notnull EntityAI e)
protected

◆ CanRemoveEntityInCargoEx()

proto native bool CanRemoveEntityInCargoEx ( notnull EntityAI e,
int idx,
int row,
int col )
protected

◆ CanSwapEntities()

CanSwapEntities ( notnull EntityAI item1,
notnull EntityAI item2 )
staticprotected

test if ordinary swap can be performed.

Ordinary in the sense that the two items has equal sizes and can be swapped without additional space.

Аргументы
[in]item1first item
[in]item2second item
Возвращает
true if can be swapped

Используется в CanSwapEntitiesEx().

◆ CanSwapEntitiesEx()

static bool CanSwapEntitiesEx ( notnull EntityAI item1,
notnull EntityAI item2 )
inlinestaticprotected
629 {
630 int slot;
633
634 item2.GetInventory().GetCurrentInventoryLocation(il2);
635 slot = il2.GetSlot();
636
637 if (item1.GetQuantity() > item1.GetTargetQuantityMax(slot))
638 return false;
639
640
641 item1.GetInventory().GetCurrentInventoryLocation(il1);
642 slot = il1.GetSlot();
643
644 if (item2.GetQuantity() > item2.GetTargetQuantityMax(slot))
645 return false;
646
647 if (!item1.CanSwapEntities(item2, il2, il1) || !item2.CanSwapEntities(item1, il1, il2))
648 {
649 return false;
650 }
651
653 }
static proto native bool CanSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
test if ordinary swap can be performed.

Перекрестные ссылки CanSwapEntities().

Используется в WeaponManager::CanSwapMagazine(), LayoutHolder::CanSwapOrTakeToHandsEx(), AttachmentCategoriesRow::Combine(), PlayerContainer::DraggingOver(), HandsContainer::DraggingOverHeader(), AttachmentCategoriesRow::DraggingOverHeader(), ClosableContainer::DraggingOverHeader(), VicinityContainer::DraggingOverIcon(), ItemManager::GetChosenCombinationFlag(), HandsContainer::GetCombinationFlags(), InventoryGridController::GetQuickbarItemColor(), HandGuardBase::GuardCondition(), PlayerContainer::OnDropReceivedFromGhostArea(), AttachmentCategoriesRow::OnDropReceivedFromHeader(), VicinityContainer::OnDropReceivedFromIcon(), ManBase::OnQuickBarSingleUse(), WeaponManager::PrepareInventoryLocationForMagazineSwap(), Attachments::Select(), Container::Select(), HandsPreview::Select(), AttachmentCategoriesRow::Select(), PlayerContainer::Select(), VicinitySlotsContainer::Select(), ZombieContainer::Select(), EntityAI::SwapEntitiesImpl(), HumanInventory::SwappingToPreviousLocation(), HandsContainer::TakeAsAttachment() и ClosableContainer::TakeAsAttachment().

◆ CanUnlockInventoryWithKey()

proto native bool CanUnlockInventoryWithKey ( notnull EntityAI key)
protected

◆ CheckDropRequest()

static proto native bool CheckDropRequest ( notnull Man requestingPlayer,
notnull InventoryLocation src,
float radius )
staticprotected

◆ CheckManipulatedObjectsDistances()

static proto native bool CheckManipulatedObjectsDistances ( notnull EntityAI e0,
notnull EntityAI e1,
float radius )
staticprotected

Используется в VicinityItemManager::AddVicinityItems().

◆ CheckMoveToDstRequest()

static proto native bool CheckMoveToDstRequest ( notnull Man requestingPlayer,
notnull InventoryLocation src,
notnull InventoryLocation dst,
float radius )
staticprotected

Используется в HandEventBase::CheckRequest().

◆ CheckRequestSrc()

static proto native bool CheckRequestSrc ( notnull Man requestingPlayer,
notnull InventoryLocation src,
float radius )
staticprotected

Используется в HandEventBase::CheckRequestSrc().

◆ CheckSwapItemsRequest()

static proto native bool CheckSwapItemsRequest ( notnull Man requestingPlayer,
notnull InventoryLocation src1,
notnull InventoryLocation src2,
notnull InventoryLocation dst1,
notnull InventoryLocation dst2,
float radius )
staticprotected

◆ CheckTakeItemRequest()

static proto native bool CheckTakeItemRequest ( notnull Man requestingPlayer,
notnull InventoryLocation src,
notnull InventoryLocation dst,
float radius )
staticprotected

◆ ClearInventoryReservation()

static proto native bool ClearInventoryReservation ( EntityAI item,
InventoryLocation dst )
staticprotected

Используется в HandStateEquipped::OnEntry().

◆ ClearInventoryReservationEx()

bool ClearInventoryReservationEx ( EntityAI item,
InventoryLocation dst )
inlineprotected
764 {
765 if (GetGame().IsMultiplayer() && GetGame().IsServer() )
766 return true;
767
769 #ifdef DEVELOPER
771 {
772 DayZPlayer player = GetGame().GetPlayer();
773 if ( player )
774 {
775 if (item)
776 Debug.InventoryMoveLog("Reservation cleared result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / " + item.ToString() + " / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "ClearInventoryReservation", player.ToString() );
777 else
778 Debug.InventoryMoveLog("Reservation cleared result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / null / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "ClearInventoryReservation", player.ToString() );
779 }
780 }
781 #endif
782 return ret_val;
783 }
void ClearInventoryReservation()
Definition Hand_Events.c:184

Перекрестные ссылки ClearInventoryReservation(), InventoryLocation::DumpToStringNullSafe(), GetGame(), Debug::InventoryMoveLog() и LogManager::IsInventoryReservationLogEnable().

◆ CountInventory()

CountInventory ( )
protected

almost identical to EnumerateInventory except it does not return items

Возвращает
number of items

◆ CreateAttachment()

CreateAttachment ( string typeName)
protected

Create Entity of specified type as attachment of entity.

◆ CreateAttachmentEx()

CreateAttachmentEx ( string typeName,
int slotId )
protected

Create Entity of specified type as attachment of entity.

Аргументы
typeNametype to create
slotIdthe slot to be created in

◆ CreateEntityInCargo()

proto native EntityAI CreateEntityInCargo ( string typeName)
protected

Create Entity of specified type in cargo of entity.

◆ CreateEntityInCargoEx()

proto native EntityAI CreateEntityInCargoEx ( string typeName,
int idx,
int row,
int col,
bool flip )
protected

Create Entity of specified type in cargo of entity at coordinates (row, col)

Аргументы
typeNametype to create
rowthe row of cargo to be created at
colthe column of cargo to be created at

◆ CreateInInventory()

CreateInInventory ( string type)
inlineprotected

creates entity somewhere in inventory

Аргументы
[in]typeitem type to be placed in inventory
Возвращает
created entity or null
876 {
879 {
880 switch (loc.GetType())
881 {
882 case InventoryLocationType.ATTACHMENT:
883 return loc.GetParent().GetInventory().CreateAttachmentEx(type, loc.GetSlot());
884 case InventoryLocationType.CARGO:
885 return loc.GetParent().GetInventory().CreateEntityInCargoEx(type, loc.GetIdx(), loc.GetRow(), loc.GetCol(), loc.GetFlip());
886 default:
887 Error("CreateInInventory: unknown location for item");
888 break;
889 }
890 }
891
892 return null;
893 }
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4
proto native bool FindFirstFreeLocationForNewEntity(string item_type, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFirstFreeLocationForNewEntity.
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error() и FindFirstFreeLocationForNewEntity().

◆ DropEntity()

bool DropEntity ( InventoryMode mode,
EntityAI owner,
notnull EntityAI item )
inlineprotected
1248 {
1249 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Drop(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1251 if (item.GetInventory().GetCurrentInventoryLocation(src))
1252 {
1255 {
1257 return false;
1258 }
1259
1260 return TakeToDst(mode, src, dst);
1261 }
1262
1263 Error("DropEntity - No inventory location");
1264 return false;
1265 }
void inventoryDebugPrint(string s)
Definition Debug.c:19
InventoryCommandType
Definition Inventory.c:3
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
InventoryValidationReason
Definition Inventory.c:37
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition Inventory.c:1238
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
Definition Inventory.c:1056
void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
static bool IsInventoryMoveLogEnable()
Definition Debug.c:789

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable(), OnInventoryFailure(), SetGroundPosByOwner() и TakeToDst().

◆ DropEntityInBounds()

bool DropEntityInBounds ( InventoryMode mode,
EntityAI owner,
notnull EntityAI item,
vector halfExtents,
float angle,
float cosAngle,
float sinAngle )
inlineprotected
1310 {
1311 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Drop(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1312
1314 if (item.GetInventory().GetCurrentInventoryLocation(src))
1315 {
1317
1319
1320 return TakeToDst(mode, src, dst);
1321 }
1322
1323 Error("DropEntityInBounds - No inventory location");
1324 return false;
1325 }
static void SetGroundPosByOwnerBounds(EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector halfExtents, float angle, float cosAngle, float sinAngle)
Definition Inventory.c:1290

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable(), SetGroundPosByOwnerBounds() и TakeToDst().

◆ DropEntityWithTransform()

bool DropEntityWithTransform ( InventoryMode mode,
EntityAI owner,
notnull EntityAI item,
vector transform[4] )
inlineprotected
1275 {
1276 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Drop(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1278 if (item.GetInventory().GetCurrentInventoryLocation(src))
1279 {
1282
1283 return TakeToDst(mode, src, dst);
1284 }
1285
1286 Error("DropEntityWithTransform - No inventory location");
1287 return false;
1288 }
static bool SetGroundPosByTransform(EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector transform[4])
Definition Inventory.c:1267

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable(), SetGroundPosByTransform() и TakeToDst().

◆ EEDelete()

void EEDelete ( EntityAI parent)
inlineprotected
862 {
864 Man player = item.GetHierarchyRootPlayer();
865 if (player)
866 player.GetInventory().ClearInventoryReservationEx(item, null);
867 }

Перекрестные ссылки GetInventoryOwner().

◆ EEInit()

void EEInit ( )
inlineprotected
845 {
848 {
849 if (src.GetType() == InventoryLocationType.HANDS)
850 {
851 Man man = Man.Cast(src.GetParent());
852 if (man)
853 {
854 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("Inventory::EEInit - Man=" + man + " item=" + this);
855 man.GetHumanInventory().OnEntityInHandsCreated(src);
856 }
857 }
858 }
859 }

Перекрестные ссылки GetCurrentInventoryLocation(), inventoryDebugPrint() и LogManager::IsInventoryMoveLogEnable().

◆ EnumerateInventory()

EnumerateInventory ( InventoryTraversalType tt,
out array< EntityAI > items )
protected

enumerate inventory using traversal type and filling items array

Аргументы
[in]ttused traversal type
[out]itemsitems in inventory (in order determined by traversal)
Возвращает
true if found any, false otherwise

◆ ExtendInventoryReservation()

static proto native bool ExtendInventoryReservation ( EntityAI item,
InventoryLocation dst,
int timeout_ms )
staticprotected

Используется в ExtendInventoryReservationEx().

◆ ExtendInventoryReservationEx()

bool ExtendInventoryReservationEx ( EntityAI item,
InventoryLocation dst,
int timeout_ms )
inlineprotected
741 {
742 if (GetGame().IsMultiplayer() && GetGame().IsServer() )
743 return true;
744
746 #ifdef DEVELOPER
748 {
749 DayZPlayer player = GetGame().GetPlayer();
750 if ( player )
751 {
752 if (item)
753 Debug.InventoryMoveLog("Reservation result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / " + item.ToString() + " / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "ExtendInventoryReservation", player.ToString() );
754 else
755 Debug.InventoryMoveLog("Reservation result: " + ret_val + " - STS = " + player.GetSimulationTimeStamp() + " / null / " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "ExtendInventoryReservation", player.ToString() );
756 }
757 }
758 #endif
759 return ret_val;
760 }
static proto native bool ExtendInventoryReservation(EntityAI item, InventoryLocation dst, int timeout_ms)

Перекрестные ссылки InventoryLocation::DumpToStringNullSafe(), ExtendInventoryReservation(), GetGame(), Debug::InventoryMoveLog() и LogManager::IsInventoryReservationLogEnable().

◆ FindAttachment()

proto native EntityAI FindAttachment ( int slot)
protected

Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)

◆ FindAttachmentByName()

proto native EntityAI FindAttachmentByName ( string slotName)
protected

Returns attached entity in slot (you can use EntityAI.GetActionComponentName to get slot id)

◆ FindFirstFreeLocationForNewEntity()

proto native bool FindFirstFreeLocationForNewEntity ( string item_type,
FindInventoryLocationType flags,
out notnull InventoryLocation loc )
protected

FindFirstFreeLocationForNewEntity.

Аргументы
[in]item_typeitem type that would be placed in inventory
[out]locthe InventoryLocation the item can be placed to
Возвращает
true if found any, false otherwise

Используется в CreateInInventory().

◆ FindFreeLocationFor()

proto native bool FindFreeLocationFor ( notnull EntityAI item,
FindInventoryLocationType flags,
out notnull InventoryLocation loc )
protected

FindFreeLocationFor.

Аргументы
[in]itemitem that would be placed in inventory
[out]locthe InventoryLocation the item can be placed to
Возвращает
true if found any, false otherwise

Используется в AddEntityToInventory(), CanAddEntityInto(), CanAddEntityToInventory(), HumanInventory::TakeEntityToInventory() и TakeEntityToInventory().

◆ FindFreeLocationForEx()

proto native bool FindFreeLocationForEx ( notnull EntityAI item,
FindInventoryLocationType flags,
notnull InventoryLocation exclude,
out notnull InventoryLocation loc )
protected

FindFreeLocationForEx.

Аргументы
[in]itemitem that would be placed in inventory
[out]locthe InventoryLocation the item can be placed to
Возвращает
true if found any, false otherwise

◆ FindFreeLocationsFor()

FindFreeLocationsFor ( notnull EntityAI item,
FindInventoryLocationType flags,
out notnull array< ref InventoryLocation > locs )
protected

searches inventory for suitable location for @item

Аргументы
[in]itemitem that would be placed in inventory
[in]flagsflags affecting selection (
См. также
FindInventoryLocation )
Аргументы
[out]locsarray of InventoryLocations the item can be placed to
Возвращает
number of suitable inventory locations

Example:

Entity bino = GetGame().CreateObject("Binoculars", "3312 0 854");
{
array<ref InventoryLocation> a = new array<ref InventoryLocation>; // 1) allocate memory for array
for (int i = 0; i < 10; ++i)
{
a.Insert(new InventoryLocation); // 2) pre-allocate inventorylocations from script. engine only fills them in, engine does not allocate memory to avoid mixing.
}
int sz = player.FindFreeLocationsFor(bino, FindInventoryLocationType.ANY_CARGO | FindInventoryLocationType.ATTACHMENT, a); // 3) ask engine to fill the locations
if (sz > 0)
{
bino2.GetCurrentInventoryLocation(src); // 5) get current location
InventoryLocation dst = a[0]; // 6) get first (this is only example)
... use src and dst
}
}
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Camera.c:2
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

◆ FindPlaceholderForSlot()

proto native EntityAI FindPlaceholderForSlot ( int slot)
protected

Returns placeholder entity for slot (naked arms, legs etc)

◆ FlipCargo()

proto native void FlipCargo ( )
protected

◆ ForceSwapEntities()

bool ForceSwapEntities ( InventoryMode mode,
notnull EntityAI item1,
notnull EntityAI item2,
notnull InventoryLocation item2_dst )
inlineprotected
1234 {
1235 return false;
1236 }

◆ GetAnyInventoryReservationCount()

proto native int GetAnyInventoryReservationCount ( )
protected

◆ GetAttachmentFromIndex()

GetAttachmentFromIndex ( int index)
protected
Возвращает
attached entity by attachment index @NOTE: index is not slot! for getting attachment by slot use FindAttachment

◆ GetAttachmentSlotId()

GetAttachmentSlotId ( int index)
protected
Аргументы
indexindex of the slot for attachment (
См. также
GetAttachmentSlotsCount)
Возвращает
slot for attachment

Используется в HasAttachmentSlot().

◆ GetAttachmentSlotsCount()

GetAttachmentSlotsCount ( )
protected
Возвращает
number of slots for attachments

Используется в HasAttachmentSlot().

◆ GetCargo()

proto native CargoBase GetCargo ( )
protected

cargo

◆ GetCargoFromIndex()

proto native CargoBase GetCargoFromIndex ( int index)
protected

◆ GetCurrentAttachmentSlotInfo()

bool GetCurrentAttachmentSlotInfo ( out int slot_id,
out string slot_name )
inlineprotected

Returns true if the item is currently attached and outputs attachment slot id and name.

455 {
457 slot_name = "";
460 if (lcn.GetType() == InventoryLocationType.ATTACHMENT)
461 {
462 slot_id = lcn.GetSlot();
464 return true;
465 }
466 return false;
467 }
provides access to slot configuration
Definition InventorySlots.c:6
static proto native owned string GetSlotName(int id)
converts slot_id to string
const int INVALID
Invalid slot (-1)
Definition InventorySlots.c:17

Перекрестные ссылки GetCurrentInventoryLocation(), InventorySlots::GetSlotName() и InventorySlots::INVALID.

◆ GetCurrentInventoryLocation()

GetCurrentInventoryLocation ( out notnull InventoryLocation loc)
protected

returns information about current item location

Аргументы
[out]loccurrent InventoryLocation
Возвращает
true if current location retrieved (and is valid)

Используется в CanRemoveEntity(), EEInit(), GetCurrentAttachmentSlotInfo(), IsAttachment() и IsInCargo().

◆ GetFlipCargo()

proto native bool GetFlipCargo ( )
protected

◆ GetInventoryCheckContext()

static int GetInventoryCheckContext ( )
inlinestaticprotected
374 {
376 }
static int m_inventory_check_context
Definition Inventory.c:80

Перекрестные ссылки m_inventory_check_context.

Используется в Container_Base::CanReceiveItemIntoCargo().

◆ GetInventoryOwner()

◆ GetInventoryReservationCount()

static proto native bool GetInventoryReservationCount ( EntityAI item,
InventoryLocation dst )
staticprotected

◆ GetScriptLockCount()

proto native int GetScriptLockCount ( )
protected

◆ GetSlotId()

GetSlotId ( int index)
protected

attachments

Аргументы
indexindex into array of configured slots (
См. также
GetSlotIdCount)
Возвращает
slot where this item belongs

◆ GetSlotIdCount()

GetSlotIdCount ( )
protected
Возвращает
number of slots this item can belong to

◆ GetSlotLock()

proto native bool GetSlotLock ( int slot)
protected

◆ HasAttachment()

HasAttachment ( notnull EntityAI e)
protected

brief Returns True if entity is attached to this

◆ HasAttachmentEx()

HasAttachmentEx ( notnull EntityAI e,
int slot )
protected

brief Returns True if entity is attached to this in slot

◆ HasAttachmentSlot()

HasAttachmentSlot ( int slotId)
inlineprotected
Возвращает
true if this entity has attachments slot with id=slotId
187 {
189 for (int i = 0; i < count; i++)
190 {
192 return true;
193 }
194 return false;
195 }
proto native int GetAttachmentSlotsCount()
proto native int GetAttachmentSlotId(int index)

Перекрестные ссылки GetAttachmentSlotId() и GetAttachmentSlotsCount().

◆ HasEntityInCargo()

proto native bool HasEntityInCargo ( notnull EntityAI e)
protected

◆ HasEntityInCargoEx()

proto native bool HasEntityInCargoEx ( notnull EntityAI e,
int idx,
int row,
int col )
protected

◆ HasEntityInInventory()

HasEntityInInventory ( notnull EntityAI item)
protected

query inventory if item is somewhere

All available inventory locations (hands, cargo, attachments, proxycargo, ...) are traversed recursively from root to leafs.

Аргументы
[in]itemitem to be found in inventory
Возвращает
true if found, false otherwise

◆ HasInventoryReservation()

static proto native bool HasInventoryReservation ( EntityAI item,
InventoryLocation dst )
staticprotected

Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY, FindInventoryReservationMode.LEGACY)

Используется в HandStateEquipped::OnEntry().

◆ HasInventoryReservationCanAdd()

static proto native bool HasInventoryReservationCanAdd ( EntityAI item,
InventoryLocation dst )
staticprotected

Internally: !HasInventoryReservationEx(item, dst, FindInventoryReservationMode.ITEM, FindInventoryReservationMode.DST)

◆ HasInventoryReservationEx()

static proto native bool HasInventoryReservationEx ( EntityAI item,
InventoryLocation dst,
FindInventoryReservationMode itemMode,
FindInventoryReservationMode parentMode )
staticprotected

itemMode will iterate over item reservations, parentMode will iterate over parent reservations

◆ HasInventorySlot()

HasInventorySlot ( int slotId)
protected
Возвращает
true if this entity has inventory slot with id=slotId

◆ HasKeys()

proto native bool HasKeys ( )
protected

◆ Init()

Init ( )
inlineprotected

script functions

called by engine right after creation of entity

831 {
832 GetInventoryOwner().OnInventoryInit();
833 }

Перекрестные ссылки GetInventoryOwner().

◆ IsAttachment()

bool IsAttachment ( )
inlineprotected

Returns true if this Inventory owner is an attachment of something.

409 {
412 if (lcn.GetType() == InventoryLocationType.ATTACHMENT)
413 {
414 return true;
415 }
416
417 return false;
418 }

Перекрестные ссылки GetCurrentInventoryLocation().

◆ IsCargoInHiearchy()

bool IsCargoInHiearchy ( )
inlineprotected

Returns true if inventory owner or his hiearchy parents are in cargo.

422 {
425 while (ent)
426 {
427 if (ent.GetInventory().GetCurrentInventoryLocation(lcn) && lcn.IsValid())
428 {
429 if (lcn.GetType() == InventoryLocationType.CARGO || lcn.GetType() == InventoryLocationType.PROXYCARGO)
430 return true;
431 }
432
433 ent = ent.GetHierarchyParent();
434 }
435
436 return false;
437 }

Перекрестные ссылки GetInventoryOwner().

◆ IsInCargo()

bool IsInCargo ( )
inlineprotected

Returns true if this Inventory owner is in cargo of something.

396 {
399 if (lcn.GetType() == InventoryLocationType.CARGO)
400 {
401 return true;
402 }
403
404 return false;
405 }

Перекрестные ссылки GetCurrentInventoryLocation().

◆ IsInventoryLocked()

proto native bool IsInventoryLocked ( )
protected

◆ IsInventoryLockedForLockType()

proto native bool IsInventoryLockedForLockType ( int lockType)
protected

◆ IsInventoryUnlocked()

proto native bool IsInventoryUnlocked ( )
protected

◆ IsPlaceholderEntity()

proto native bool IsPlaceholderEntity ( notnull Object e)
protected

◆ LocalDestroyEntity()

bool LocalDestroyEntity ( notnull EntityAI item)
inlineprotected
1328 {
1329 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::LocalDestroyEntity inv item=" + item);
1331 if (item.GetInventory().GetCurrentInventoryLocation(src))
1332 {
1333 if (src.GetType() == InventoryLocationType.HANDS)
1334 Error("[inv] Source location == HANDS, player has to handle this");
1335
1336 GetGame().ObjectDelete(src.GetItem());
1337 return true;
1338 }
1339
1340 Error("LocalDestroyEntity: No inventory location");
1341 return false;
1342 }

Перекрестные ссылки Error(), GetGame(), inventoryDebugPrint() и LogManager::IsInventoryMoveLogEnable().

◆ LocationAddEntity()

LocationAddEntity ( notnull InventoryLocation inv_loc)
staticprotected

adds item to inventory location

Возвращает
true if success, false otherwise

Используется в AddEntityToInventory() и ReplaceItemWithNewLambdaBase::UndoRemoveOldItemFromLocation().

◆ LocationCanAddEntity()

LocationCanAddEntity ( notnull InventoryLocation inv_loc)
staticprotected

queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/...

query the entity at the specific inventory location

Возвращает
true if can be added, false otherwise
entity at the location, null otherwise

Используется в LocationCanAddEntityEx() и TransferInventory().

◆ LocationCanAddEntityEx()

static bool LocationCanAddEntityEx ( notnull InventoryLocation inv_loc)
inlinestaticprotected
349 {
351 }
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/....

Перекрестные ссылки LocationCanAddEntity().

◆ LocationCanMoveEntity()

LocationCanMoveEntity ( notnull InventoryLocation src,
notnull InventoryLocation dst )
staticprotected

queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthand for CanRemove + CanAdd query

Возвращает
true if can be moved, false otherwise

Используется в HandEventBase::CanPerformEvent(), HandEventBase::CanPerformEventEx(), HandGuardBase::GuardCondition(), LocationCanMoveEntitySyncCheck(), WeaponStateBase::OnAbort(), OnAbort(), HandStateBase::OnEntry(), HandStartAction::OnEntry(), WeaponStateBase::OnExit() и ValidateSyncMove().

◆ LocationCanMoveEntitySyncCheck()

static bool LocationCanMoveEntitySyncCheck ( notnull InventoryLocation src,
notnull InventoryLocation dst )
inlinestaticprotected
379 {
383 return result;
384
385 }
InventoryCheckContext
Definition Inventory.c:58
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...

Перекрестные ссылки LocationCanMoveEntity() и m_inventory_check_context.

Используется в ValidateSyncMove().

◆ LocationCanRemoveEntity()

LocationCanRemoveEntity ( notnull InventoryLocation inv_loc)
staticprotected

queries if the entity contained in inv_loc.m_item can be removed from ground/attachment/cargo/hands/...

Возвращает
true if can be added, false otherwise

Используется в ReplaceItemWithNewLambdaBase::CanExecuteLambda(), CanRemoveEntity() и ActionDigInStash::OnFinishProgressServer().

◆ LocationCreateEntity()

LocationCreateEntity ( notnull InventoryLocation inv_loc,
string type,
int iSetupFlags,
int iRotation )
staticprotected

creates new item directly at location

Аргументы
[in]typeitem type to be placed in inventory
Возвращает
created entity, null otherwise

Используется в ReplaceItemWithNewLambdaBase::CreateNewEntity(), SpawnEntity(), InventoryItem::SplitIntoStackMaxToInventoryLocationEx(), InventoryItem::SplitItemToInventoryLocation(), ThrowEntityFromInventory() и ActionUncoverHeadBase::UncoverHead().

◆ LocationCreateLocalEntity()

LocationCreateLocalEntity ( notnull InventoryLocation inv_loc,
string type,
int iSetupFlags,
int iRotation )
staticprotected

creates new local item directly at location @NOTE: the item is created localy, i.e. it's not registered to network

Аргументы
[in]typeitem type to be placed in inventory
Возвращает
created entity, null otherwise

Используется в ReplaceItemWithNewLambdaBase::CreateNewEntity().

◆ LocationGetEntity()

static proto native EntityAI LocationGetEntity ( notnull InventoryLocation inv_loc)
staticprotected

◆ LocationMoveEntity()

LocationMoveEntity ( notnull InventoryLocation src_loc,
notnull InventoryLocation dst_loc )
staticprotected

removes item from current inventory location and adds it to destination

Возвращает
true if success, false otherwise

◆ LocationRemoveEntity()

LocationRemoveEntity ( notnull InventoryLocation inv_loc)
staticprotected

removes item from inventory location

Возвращает
true if success, false otherwise

Используется в ReplaceItemWithNewLambdaBase::RemoveOldItemFromLocation().

◆ LocationSwap()

LocationSwap ( notnull InventoryLocation src1,
notnull InventoryLocation src2,
notnull InventoryLocation dst1,
notnull InventoryLocation dst2 )
staticprotected

swaps two entities

Возвращает
true if success, false otherwise

Используется в HandActionBase::Action(), HandStartAction::OnEntry() и OnServerInventoryCommandStatic().

◆ LocationSyncMoveEntity()

LocationSyncMoveEntity ( notnull InventoryLocation src_loc,
notnull InventoryLocation dst_loc )
staticprotected

synchronously removes item from current inventory location and adds it to destination no anims involved

Возвращает
true if success, false otherwise

Используется в HandActionBase::Action(), HandleDropMagazine(), WeaponStateBase::OnAbort(), OnAbort(), HandStateBase::OnEntry(), HandStartAction::OnEntry(), WeaponStateBase::OnEntry(), WeaponStateBase::OnExit(), OnServerInventoryCommandStatic() и TakeToDst().

◆ LocationTestAddEntity()

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 )
staticprotected

test if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/...

Возвращает
true if can be added, false otherwise

Используется в HandGuardBase::GuardCondition().

◆ LockInventory()

proto native void LockInventory ( int lockType)
protected

◆ LockInventoryWithKey()

proto native void LockInventoryWithKey ( notnull EntityAI key)
protected

◆ MakeDstForSwap()

static bool MakeDstForSwap ( notnull InventoryLocation src1,
notnull InventoryLocation src2,
out InventoryLocation dst1,
out InventoryLocation dst2 )
inlinestaticprotected

helper function for swap

1174 {
1175 if (dst1 == null)
1176 dst1 = new InventoryLocation();
1177
1178 dst1.Copy(src1);
1179 dst1.CopyLocationFrom(src2, false);
1180 dst1.SetFlip(src1.GetItem().GetInventory().GetFlipCargo()); // update flip flag from inventory item
1181
1182 if (dst2 == null)
1183 dst2 = new InventoryLocation();
1184
1185 dst2.Copy(src2);
1186 dst2.CopyLocationFrom(src1, false);
1187 dst2.SetFlip(src2.GetItem().GetInventory().GetFlipCargo()); // update flip flag from inventory item
1188 return true;
1189 }

Используется в MakeSrcAndDstForSwap().

◆ MakeSrcAndDstForForceSwap()

static bool MakeSrcAndDstForForceSwap ( notnull EntityAI item1,
notnull EntityAI item2,
out InventoryLocation src1,
out InventoryLocation src2,
out InventoryLocation dst1,
notnull InventoryLocation dst2 )
inlinestaticprotected

helper function for ForceSwap

1205 {
1206 if (src1 == null)
1207 src1 = new InventoryLocation();
1208 if (src2 == null)
1209 src2 = new InventoryLocation();
1210
1211 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
1212 {
1213 // src1 -> dst_of(src2)
1214 if (dst1 == null)
1215 dst1 = new InventoryLocation();
1216
1217 dst1.Copy(src1);
1218 dst1.CopyLocationFrom(src2, false);
1219 dst1.SetFlip(dst1.GetItem().GetInventory().GetFlipCargo());
1220
1221 // src2 -> dst2 from user
1222 return true;
1223 }
1224
1225 return false;
1226 }

Используется в HumanInventory::ForceSwapEntities() и ForceSwapEntities().

◆ MakeSrcAndDstForSwap()

static bool MakeSrcAndDstForSwap ( notnull EntityAI item1,
notnull EntityAI item2,
out InventoryLocation src1,
out InventoryLocation src2,
out InventoryLocation dst1,
out InventoryLocation dst2 )
inlinestaticprotected

helper function for swap

1193 {
1194 if (src1 == null)
1195 src1 = new InventoryLocation();
1196 if (src2 == null)
1197 src2 = new InventoryLocation();
1198 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
1199 return MakeDstForSwap(src1, src2, dst1, dst2);
1200 return false;
1201 }
static bool MakeDstForSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
Definition Inventory.c:1173

Перекрестные ссылки MakeDstForSwap().

Используется в HandleSwapEntities(), HumanInventory::SwapEntities() и SwapEntities().

◆ OnAfterStoreLoad()

void OnAfterStoreLoad ( )
protected

◆ OnInputUserDataProcess()

bool OnInputUserDataProcess ( ParamsReadContext ctx)
protected

synchronization

◆ OnInventoryFailure()

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

Используется в DropEntity().

◆ OnInventoryJunctureFailureFromServer()

void OnInventoryJunctureFailureFromServer ( ParamsReadContext ctx)
protected

◆ OnInventoryJunctureFromServer()

bool OnInventoryJunctureFromServer ( ParamsReadContext ctx)
protected

◆ OnInventoryJunctureRepairFromServer()

bool OnInventoryJunctureRepairFromServer ( ParamsReadContext ctx)
protected

◆ OnServerInventoryCommand()

void OnServerInventoryCommand ( ParamsReadContext ctx)
protected

◆ OnServerInventoryCommandStatic()

static void OnServerInventoryCommandStatic ( ParamsReadContext ctx)
inlinestaticprotected
470 {
471 int tmp = -1;
472 ctx.Read(tmp);
473
474 int type = -1;
475 if (!ctx.Read(type))
476 return;
477
478 switch (type)
479 {
480 case InventoryCommandType.SYNC_MOVE:
481 {
484
485 src.ReadFromContext(ctx);
486 dst.ReadFromContext(ctx);
487 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + GetGame().GetTime() + "ms ServerInventoryCommand cmd=" + typename.EnumToString(InventoryCommandType, type) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
488
489 if (!src.GetItem() || !dst.GetItem())
490 {
491 LogError("[syncinv] ServerInventoryCommand (cmd=SYNC_MOVE) dropped, item not in bubble");
492 break; // not in bubble
493 }
494
496 break;
497 }
498
499 case InventoryCommandType.HAND_EVENT:
500 {
501 HandEventBase e = HandEventBase.CreateHandEventFromContext(ctx);
502 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + GetGame().GetTime() + "ms ServerInventoryCommand cmd=" + typename.EnumToString(InventoryCommandType, type) + " event=" + e.DumpToString());
503
504 if (!e.GetSrcEntity())
505 {
506 Error("[syncinv] ServerInventoryCommand (cmd=HAND_EVENT) dropped, item not in bubble");
507 break; // not in bubble
508 }
509 e.m_Player.GetHumanInventory().ProcessHandEvent(e);
510 break;
511 }
512
513 case InventoryCommandType.FORCESWAP:
514 case InventoryCommandType.SWAP:
515 {
520 src1.ReadFromContext(ctx);
521 src2.ReadFromContext(ctx);
522 dst1.ReadFromContext(ctx);
523 dst2.ReadFromContext(ctx);
524
525 if (src1.IsValid() && src2.IsValid() && dst1.IsValid() && dst2.IsValid())
526 {
528
530 }
531 else
532 Error("ServerInventoryCommand - cannot swap, invalid location input: src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(dst2));
533
534 break;
535 }
536 }
537 }
void syncDebugPrint(string s)
Definition Debug.c:1
void LogError(string message, LogTemplateID template_id=0)
Creates error log (optional) from LogTemplate which are registred.
Definition LogTemplates.c:129
float GetTime()
Definition NotificationSystem.c:35
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
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 involv...
Abstracted event, not to be used, only inherited.
Definition Hand_Events.c:195
static bool IsSyncLogEnable()
Definition Debug.c:819

Перекрестные ссылки InventoryLocation::DumpToStringNullSafe(), Error(), GetGame(), GetTime(), LogManager::IsSyncLogEnable(), LocationSwap(), LocationSyncMoveEntity(), LogError() и syncDebugPrint().

◆ OnStoreLoad()

bool OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

db load hooks

837 {
838 return true;
839 }

◆ OnStoreSave()

void OnStoreSave ( ParamsWriteContext ctx)
protected

db store hook

◆ PrepareDropEntityPos()

PrepareDropEntityPos ( EntityAI owner,
notnull EntityAI item,
out vector mat[4],
bool useValuesInMatrix = false,
int conflictCheckDepth = -1 )
staticprotected

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.

Аргументы
useValuesInMatrixIs ignored if transformation overlaps with possible conflicting entity. If no valid transform is found and this is false then the transform at the owner is used for 'PlaceOnSurface'
conflictCheckDepthIf -1 then no conflict depth check is performed, if 0 then it only checks to see if it conflicts but doesn't perform snapping
Возвращает
true if valid transformation found near owner

Используется в DropEquipAndDestroyRootLambda::CopyOldPropertiesToNew(), HandleDropMagazine(), ManBase::PredictiveDropEntity(), SetGroundPosByOwner() и SetGroundPosByTransform().

◆ ReplaceItemWithNew()

bool ReplaceItemWithNew ( InventoryMode mode,
ReplaceItemWithNewLambdaBase lambda )
inlineprotected
1345 {
1347 if (lambda.m_OldItem.GetInventory().GetCurrentInventoryLocation(src))
1348 {
1349 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::ReplaceItemWithNew executing lambda=" + lambda + "on old_item=" + lambda.m_OldItem);
1350 lambda.Execute();
1351 return true;
1352 }
1353
1354 Error("[inv] I::ReplaceItemWithNew - no inventory location");
1355 return false;
1356 }

Перекрестные ссылки Error(), inventoryDebugPrint() и LogManager::IsInventoryMoveLogEnable().

◆ ResetFlipCargo()

proto native void ResetFlipCargo ( )
protected

◆ ServerHandEvent()

ServerHandEvent ( notnull Man player,
notnull EntityAI item,
ParamsWriteContext ctx )
staticprotected

hand event to clients

Возвращает
true if success, false otherwise

Используется в InventoryInputUserData::SendServerHandEventViaInventoryCommand().

◆ ServerLocationMoveEntity()

ServerLocationMoveEntity ( notnull EntityAI item,
ParamsWriteContext ctx )
staticprotected

removes item from current inventory location and adds it to destination + sync via inventory command

Возвращает
true if success, false otherwise

◆ ServerLocationSwap()

ServerLocationSwap ( notnull InventoryLocation src1,
notnull InventoryLocation src2,
notnull InventoryLocation dst1,
notnull InventoryLocation dst2,
ParamsWriteContext ctx )
staticprotected

swaps two entities

Возвращает
true if success, false otherwise

Используется в InventoryInputUserData::SendServerSwap().

◆ ServerLocationSyncMoveEntity()

ServerLocationSyncMoveEntity ( Man player,
notnull EntityAI item,
ParamsWriteContext ctx )
staticprotected

synchronously removes item from current inventory location and adds it to destination + sync via inventory command no anims involved

Возвращает
true if success, false otherwise

Используется в InventoryInputUserData::SendServerMove().

◆ SetFlipCargo()

proto native void SetFlipCargo ( bool flip)
protected

◆ SetGroundPosByOwner()

static bool SetGroundPosByOwner ( EntityAI owner,
notnull EntityAI item,
out InventoryLocation ground )
inlinestaticprotected
1239 {
1240 vector m4[4];
1243 ground.SetGround(item, m4);
1244 return success;
1245 }
Definition constants.c:615
script counterpart to engine's class Inventory
Definition Inventory.c:79
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 anoth...
Definition EnMath3D.c:28
Definition EnConvert.c:106
const int INVENTORY_ENTITY_DROP_OVERLAP_DEPTH
Definition constants.c:911
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:256

Перекрестные ссылки GameConstants::INVENTORY_ENTITY_DROP_OVERLAP_DEPTH, Math3D::MatrixIdentity4() и PrepareDropEntityPos().

Используется в HandEventRemove::CanPerformEventEx(), HandEventRemove::CheckRequestEx(), DropEntity(), OnEntry(), ActionUnpackGift::OnFinishProgressServer() и StaticConstructionMethods::SpawnConstructionMaterialPiles().

◆ SetGroundPosByOwnerBounds()

static void SetGroundPosByOwnerBounds ( EntityAI owner,
notnull EntityAI item,
out InventoryLocation ground,
vector halfExtents,
float angle,
float cosAngle,
float sinAngle )
inlinestaticprotected
1291 {
1292 vector m4[4];
1293 owner.GetTransform(m4);
1294
1297
1298 float dist = randomPos[0] * m4[1][0] + randomPos[1] * m4[1][1] + randomPos[2] * m4[1][2];
1299
1300 m4[3][0] = m4[3][0] + randomPos[0];
1301 m4[3][1] = m4[3][1] - dist + halfExtents[1];
1302 m4[3][2] = m4[3][2] + randomPos[2];
1303
1304 item.PlaceOnSurfaceRotated(m4, Vector(m4[3][0], m4[3][1], m4[3][2]));
1305
1306 ground.SetGround(item, m4);
1307 }
Definition EnMath.c:7
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
Definition EnConvert.c:477
static const vector Up
Definition EnConvert.c:107
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].

Перекрестные ссылки Math::RandomFloat(), vector::RotateAroundZero(), vector::Up и Vector().

Используется в DropEntityInBounds().

◆ SetGroundPosByTransform()

static bool SetGroundPosByTransform ( EntityAI owner,
notnull EntityAI item,
out InventoryLocation ground,
vector transform[4] )
inlinestaticprotected

Перекрестные ссылки GameConstants::INVENTORY_ENTITY_DROP_OVERLAP_DEPTH и PrepareDropEntityPos().

Используется в DropEntityWithTransform().

◆ SetSlotLock()

proto native bool SetSlotLock ( int slot,
bool locked )
protected

◆ SwapEntities()

bool SwapEntities ( InventoryMode mode,
notnull EntityAI item1,
notnull EntityAI item2 )
inlineprotected
1229 {
1230 return false;
1231 }

◆ TakeEntityAsAttachment()

bool TakeEntityAsAttachment ( InventoryMode mode,
notnull EntityAI item )
inlineprotected
1161 {
1162 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1164 }
bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Put item anywhere into this entity (as attachment or into cargo, recursively)
Definition Inventory.c:1012

Перекрестные ссылки inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeEntityToInventory().

Используется в EntityAI::TakeEntityAsAttachmentImpl().

◆ TakeEntityAsAttachmentEx()

bool TakeEntityAsAttachmentEx ( InventoryMode mode,
notnull EntityAI item,
int slot )
inlineprotected
1130 {
1131 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " slot=" + slot);
1133 }
bool TakeEntityAsTargetAttachmentEx(InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
put item as attachment of target
Definition Inventory.c:1136

Перекрестные ссылки GetInventoryOwner(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeEntityAsTargetAttachmentEx().

◆ TakeEntityAsTargetAttachment()

bool TakeEntityAsTargetAttachment ( InventoryMode mode,
notnull EntityAI target,
notnull EntityAI item )
inlineprotected
1167 {
1168 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1170 }
bool TakeEntityToTargetInventory(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
helper that finds location first, then moves the entity into it
Definition Inventory.c:1031

Перекрестные ссылки inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeEntityToTargetInventory().

◆ TakeEntityAsTargetAttachmentEx()

bool TakeEntityAsTargetAttachmentEx ( InventoryMode mode,
notnull EntityAI target,
notnull EntityAI item,
int slot )
inlineprotected

put item as attachment of target

1137 {
1138 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2TargetAttEx(" + typename.EnumToString(InventoryMode, mode) + ") as ATT of target=" + target + " item=" + item + " slot=" + slot);
1140 if (item.GetInventory().GetCurrentInventoryLocation(src))
1141 {
1142
1143 EntityAI att = target.GetInventory().FindAttachment(slot);
1144 if (att)
1145 {
1146 att.CombineItemsClient(item, true);
1147 return true;
1148 }
1149 else
1150 {
1152 dst.SetAttachment(target, item, slot);
1153 return TakeToDst(mode, src, dst);
1154 }
1155 }
1156 Error("[inv] I::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Error - src has no inventory location");
1157 return false;
1158 }

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

Используется в TakeEntityAsAttachmentEx().

◆ TakeEntityToCargo()

TakeEntityToCargo ( InventoryMode mode,
notnull EntityAI item )
inlineprotected

moves item to cargo of this intentory

Аргументы
[in]modeinventory mode
[in]itemitem to be put in this inventory as cargo
1081 {
1082 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1084 }

Перекрестные ссылки inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeEntityToInventory().

Используется в EntityAI::TakeEntityToCargoImpl().

◆ TakeEntityToCargoEx()

TakeEntityToCargoEx ( InventoryMode mode,
notnull EntityAI item,
int idx,
int row,
int col )
inlineprotected

moves item on specific cargo location

Аргументы
[in]modeinventory mode
[in]itemitem to be put in this inventory as cargo
1099 {
1100 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " row=" + row + " col=" + col);
1102 if (item.GetInventory().GetCurrentInventoryLocation(src))
1103 {
1105 dst.SetCargo(GetInventoryOwner(), item, idx, row, col, item.GetInventory().GetFlipCargo());
1106
1107 return TakeToDst(mode, src, dst);
1108 }
1109 Error("[inv] I::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " row=" + row + " col=" + col + " Error - src has no inventory location");
1110 return false;
1111 }

Перекрестные ссылки Error(), GetInventoryOwner(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

◆ TakeEntityToInventory()

TakeEntityToInventory ( InventoryMode mode,
FindInventoryLocationType flags,
notnull EntityAI item )
inlineprotected

Put item anywhere into this entity (as attachment or into cargo, recursively)

Аргументы
[in]modeinventory mode
[in]flagspreferred location,
См. также
FindInventoryLocationType
Аргументы
[in]itemitem to be taken in inventory
Возвращает
true on success

@NOTE: Predictive.* / Local.* functions: a) 'Predictive' means that the operation uses Client-Side Prediction, i.e. the action runs the same code on both, client AND server.

b) 'Local' operation executes from where it is run, i.e. the operation from client is NOT sent to server, and only client performs the inventory operation (TakeEntityTo.*) this behaviour is necessary when inventory operations are ALREADY synchronized by another means, like Actions. For example

См. также
ActionTakeItemToHands that performs OnCompleteServer and OnCompleteClient with synchronization set to false in order to avoid duplicate synchronization.
1013 {
1014 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1015
1017 if (item.GetInventory().GetCurrentInventoryLocation(src))
1018 {
1020 if (FindFreeLocationFor(item, flags, dst))
1021 return TakeToDst(mode, src, dst);
1022
1023 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Warning - no room for item");
1024 return false;
1025 }
1026 Error("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Error - src has no inventory location");
1027 return false;
1028 }

Перекрестные ссылки Error(), FindFreeLocationFor(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

Используется в TakeEntityAsAttachment() и TakeEntityToCargo().

◆ TakeEntityToTargetCargo()

bool TakeEntityToTargetCargo ( InventoryMode mode,
notnull EntityAI target,
notnull EntityAI item )
inlineprotected

Put item into into cargo of another entity.

1088 {
1089 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2TargetCgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + "to cargo of target=" + target);
1091 }

Перекрестные ссылки inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeEntityToTargetInventory().

◆ TakeEntityToTargetCargoEx()

bool TakeEntityToTargetCargoEx ( InventoryMode mode,
notnull CargoBase cargo,
notnull EntityAI item,
int row,
int col )
inlineprotected

Put item into into cargo on specific cargo location of another entity.

1115 {
1116 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2TargetCgoEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + "to cargo of target=" + cargo.GetCargoOwner() + " row=" + row + " col=" + col);
1118 if (item.GetInventory().GetCurrentInventoryLocation(src))
1119 {
1121 dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
1122
1123 return TakeToDst(mode, src, dst);
1124 }
1125 Error("[inv] I::Take2TargetCgoEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + "to cargo of target=" + cargo.GetCargoOwner() + " row=" + row + " col=" + col);
1126 return false;
1127 }

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

◆ TakeEntityToTargetInventory()

bool TakeEntityToTargetInventory ( InventoryMode mode,
notnull EntityAI target,
FindInventoryLocationType flags,
notnull EntityAI item )
inlineprotected

helper that finds location first, then moves the entity into it

1032 {
1033 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Target(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1034
1036 if (item.GetInventory().GetCurrentInventoryLocation(src))
1037 {
1039
1040 if (target.GetInventory().FindFreeLocationFor(item, flags, dst))
1041 return TakeToDst(mode, src, dst);
1042
1043 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Target(" + typename.EnumToString(InventoryMode, mode) + ") target=" + target + " item=" + item + " Warning - no room for item in target");
1044 return false;
1045 }
1046 Error("[inv] I::Take2Target(" + typename.EnumToString(InventoryMode, mode) + ") target=" + target + " item=" + item + " Error - src has no inventory location");
1047 return false;
1048 }

Перекрестные ссылки Error(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

Используется в TakeEntityAsTargetAttachment() и TakeEntityToTargetCargo().

◆ TakeToDst()

TakeToDst ( InventoryMode mode,
notnull InventoryLocation src,
notnull InventoryLocation dst )
inlineprotected

move src to dst

Аргументы
[in]modeinventory mode
[in]srcsource location of the item
[in]dstdestination location of the item
1057 {
1058 bool ret;
1059 switch (mode)
1060 {
1061 case InventoryMode.SERVER:
1063 if (ret && dst.IsValid())
1065 return ret;
1066 case InventoryMode.LOCAL:
1068 return ret;
1069 default:
1070 return false;
1071 }
1072 return false;
1073 }
Definition InventoryInputUserData.c:3
static void SendServerMove(Man player, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
Definition InventoryInputUserData.c:24

Перекрестные ссылки LocationSyncMoveEntity() и InventoryInputUserData::SendServerMove().

Используется в DropEntity(), DropEntityInBounds(), DropEntityWithTransform(), TakeEntityAsTargetAttachmentEx(), TakeEntityToCargoEx(), TakeEntityToInventory(), TakeEntityToTargetCargoEx() и TakeEntityToTargetInventory().

◆ TestAddEntityInCargoEx()

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 )
protected

◆ TestAddEntityInCargoExLoc()

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 )
protected

◆ TestDropEntityPos()

static proto native bool TestDropEntityPos ( EntityAI owner,
notnull EntityAI item,
out vector mat[4],
bool useValuesInMatrix = false,
int conflictCheckDepth = -1 )
staticprotected

◆ UnlockInventory()

proto native void UnlockInventory ( int lockType)
protected

◆ UnlockInventoryWithKey()

proto native void UnlockInventoryWithKey ( notnull EntityAI key)
protected

Поля

◆ c_InventoryReservationTimeoutMS

◆ c_InventoryReservationTimeoutShortMS

◆ c_MaxItemDistanceRadius

◆ m_inventory_check_context

int m_inventory_check_context = InventoryCheckContext.DEFAULT
staticprotected

Объявления и описания членов класса находятся в файле: