3class CachedEquipmentStorageInventoryEntry
34 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
35 newItemAttributes.m_Entity = entity;
36 newItemAttributes.m_Parent = parent;
37 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
38 newItemAttributes.m_SlotIndex = slotId;
42 LogMessage(
string.Format(
"parent:%1 entity:%2 (slot:%3)", parent, entity,
InventorySlots.
GetSlotName(slotId)),
"OnItemAttached");
45 Insert(category, newItemAttributes);
48 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
49 params.m_Entity = item;
50 params.m_GameInventory = item.GetInventory();
51 params.m_SlotId = slotId;
52 params.m_CallerMethod =
"OnItemAttached";
68 LogMessage(
string.Format(
"parent:%1 entity:%2 (slot:%3)", parent, entity,
InventorySlots.
GetSlotName(slotId)),
"OnItemDetached");
74 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
75 params.m_Entity = item;
76 params.m_GameInventory = item.GetInventory();
77 params.m_SlotId = slotId;
78 params.m_CallerMethod =
"OnItemDetached";
89 if (!item.GetHierarchyParent())
95 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
96 newItemAttributes.m_Entity = entity;
97 newItemAttributes.m_Parent = item.GetHierarchyParent();
98 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
101 #ifdef ENABLE_LOGGING
102 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoIn");
105 Insert(category, newItemAttributes);
108 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
109 params.m_Entity = item;
110 params.m_GameInventory = item.GetInventory();
111 params.m_CallerMethod =
"OnItemCargoIn";
125 #ifdef ENABLE_LOGGING
126 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoOut");
132 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
133 params.m_Entity = item;
134 params.m_GameInventory = item.GetInventory();
135 params.m_CallerMethod =
"OnItemCargoOut";
148 foreach (CachedEquipmentItemAttribute attachmentAttribute : attachmentAttributes)
151 Insert(attachmentCategory, attachmentAttribute);
153 Remove(attachmentCategory, attachmentAttribute.m_Entity);
160 foreach (CachedEquipmentItemAttribute cargoAttribute : cargoAttributes)
163 Insert(cargoCategory, cargoAttribute);
165 Remove(cargoCategory, cargoAttribute.m_Entity);
180 int attachments = params.m_GameInventory.AttachmentCount();
181 for (
int attachmentIndex = 0; attachmentIndex < attachments; ++attachmentIndex)
183 EntityAI attachment = params.m_GameInventory.GetAttachmentFromIndex(attachmentIndex);
192 params.m_GameInventory.GetCurrentInventoryLocation(parentInventoryLocation);
194 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
195 newItemAttributes.m_Entity = attachment;
196 newItemAttributes.m_Parent = attachment.GetHierarchyParent();
197 newItemAttributes.m_ParentInventoryPlacement = parentInventoryLocation.
GetSlot();
198 newItemAttributes.m_InventoryDepth = attachment.GetHierarchyLevel();
199 newItemAttributes.m_SlotIndex = params.m_SlotId;
203 if (!attachmentAttributesPerCategory.Find(category, arr))
206 attachmentAttributesPerCategory.Set(category, arr);
209 #ifdef ENABLE_LOGGING
210 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, attachment),
string.Format(
"%1:ProcessAttachments", params.m_CallerMethod));
213 arr.Insert(newItemAttributes);
216 return attachmentAttributesPerCategory;
228 if (params.m_GameInventory.GetCargo())
230 int cargoCount = params.m_GameInventory.GetCargo().GetItemCount();
231 for (
int cargoIndex = 0; cargoIndex < cargoCount; ++cargoIndex)
233 EntityAI cargo = params.m_GameInventory.GetCargo().GetItem(cargoIndex);
242 params.m_GameInventory.GetCurrentInventoryLocation(parentInventoryLocation);
244 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
246 newItemAttributes.m_Entity = cargo;
247 newItemAttributes.m_Parent = cargo.GetHierarchyParent();
248 newItemAttributes.m_ParentInventoryPlacement = parentInventoryLocation.
GetSlot();
249 newItemAttributes.m_InventoryDepth = cargo.GetHierarchyLevel();
254 if (!cargoAttributesPerCategory.Find(category, arr))
257 cargoAttributesPerCategory.Set(category, arr);
260 #ifdef ENABLE_LOGGING
261 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, cargo),
string.Format(
"%1:ProcessCargo", params.m_CallerMethod));
264 arr.Insert(newItemAttributes);
268 return cargoAttributesPerCategory;
273 #ifdef ENABLE_LOGGING
274 private void LogMessage(
string message,
string method)
276 #ifdef CACHED_EQUIPMENT_STORAGE_LOGGING
map CachedItemAttributesPerCategory
ECachedEquipmentItemCategory
ECachedEquipmentOperationMode
ECachedEquipmentPlacement
void ProcessItemInventory(CachedEquipmentStorageInventoryEntry params)
map< ECachedEquipmentItemCategory, ref array< ref CachedEquipmentItemAttribute > > ProcessAttachments(CachedEquipmentStorageInventoryEntry params)
Processes attachments of item given through params.
map< ECachedEquipmentItemCategory, ref array< ref CachedEquipmentItemAttribute > > ProcessCargo(CachedEquipmentStorageInventoryEntry params)
Processes cargo of item given through params.
void CachedEquipmentStorage(DayZPlayerImplement player)
override void OnItemDetached(notnull Entity entity, int slotId, notnull Entity parent)
DayZPlayerImplement m_Player
override void OnItemAttached(notnull Entity entity, int slotId, notnull Entity parent)
override void OnItemCargoOut(notnull Entity entity)
override void OnItemCargoIn(notnull Entity entity)
bool IsStored(Entity entity, ECachedEquipmentItemCategory category)
void Insert(ECachedEquipmentItemCategory category, CachedEquipmentItemAttribute attributes)
void CachedEquipmentStorageBase()
void Remove(ECachedEquipmentItemCategory category, Entity entity)
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
static string GetDebugName(Managed entity)
script counterpart to engine's class Inventory
proto native int GetSlot()
returns slot id if current type is Attachment
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.
ECachedEquipmentOperationMode m_OperationMode
GameInventory m_GameInventory
ECachedEquipmentPlacement m_InventoryPlacement