9class CachedEquipmentItemAttribute
30 return string.Format(
"entity:%1(%2 - %3), parent:%4(%5), inventoryDepth:%6",
40 return string.
Format(
"entity:%1(%2), parent:%3(%4) , inventoryDepth:%5",
74 foreach (
int category: categoriesAll)
77 matchedCategories.Insert(category);
82 if (matchedCategories.Count() > 0)
84 foreach (
int matchedCategory : matchedCategories)
88 bool placementMatched =
false;
89 bool parentPlacementMatched =
false;
90 bool inventoryDepthMatched =
false;
93 placementMatched =
true;
96 parentPlacementMatched =
true;
99 inventoryDepthMatched =
true;
101 if (placementMatched && parentPlacementMatched && inventoryDepthMatched)
102 entities.Insert(itemAttributes.m_Entity);
136 if (itemAttributes.m_Entity == entity)
164 if (attributeToRemove.m_Entity == entity)
165 toRemove.Insert(attributeToRemove);
168 foreach (CachedEquipmentItemAttribute attribute : toRemove)
189 if (!itemAttributes || !itemAttributes.m_Parent)
193 if (!
Class.
CastTo(parent, itemAttributes.m_Parent))
197 if (!parentInventory)
201 itemAttributes.m_ParentInventoryPlacement = parentInventoryLocation.
GetSlot();
208 #ifdef DIAG_DEVELOPER
215 Print(itemAttributes.Debug());
224 Print(
"--------------------------");
225 Print(
"Equipped Items Cache Stats");
231 PrintCachedEntitiesByCategory(category);
233 Print(
"--------------------------");
int m_ParentInventoryPlacement
class CachedEquipmentStorageQuery m_SlotIndex
ECachedEquipmentPlacement m_InventoryPlacement
ECachedEquipmentItemCategory
ECachedEquipmentPlacement
void OnItemCargoOut(notnull Entity entity)
bool IsStored(Entity entity, ECachedEquipmentItemCategory category)
void OnItemAttached(notnull Entity entity, int slotId, notnull Entity parent)
array< Entity > GetEntitiesByCategory(CachedEquipmentStorageQuery query)
List of entities matching the CachedEquipmentStorageQuery query.
ref map< ECachedEquipmentItemCategory, ref array< ref CachedEquipmentItemAttribute > > m_ItemsCacheByCategory
void Insert(ECachedEquipmentItemCategory category, CachedEquipmentItemAttribute attributes)
void CachedEquipmentStorageBase()
void OnItemDetached(notnull Entity entity, int slotId, notnull Entity parent)
void OnItemCargoIn(notnull Entity entity)
void Remove(ECachedEquipmentItemCategory category, Entity entity)
array< Entity > GetEntitiesByCategory(ECachedEquipmentItemCategory category, ECachedEquipmentPlacement placement=ECachedEquipmentPlacement.ANY)
List of entities matching the category and inventory placement.
ECachedEquipmentItemCategory m_Category
ref TIntArray m_ParentPlacement
ECachedEquipmentPlacement m_Placement
Super root of all classes in Enforce script.
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
script counterpart to engine's class Inventory
proto native int GetSlot()
returns slot id if current type is Attachment
const int INVALID
Invalid slot (-1)
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const int INDEX_NOT_FOUND
proto void Print(void var)
Prints content of variable to console/log.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.