3class CachedEquipmentStorageInventoryEntry
33 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
34 newItemAttributes.m_Entity = entity;
35 newItemAttributes.m_Parent = parent;
36 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
37 newItemAttributes.m_SlotIndex = slotId;
41 LogMessage(
string.Format(
"parent:%1 entity:%2 (slot:%3)", parent, entity,
InventorySlots.GetSlotName(slotId)),
"OnItemAttached");
44 Insert(category, newItemAttributes);
47 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
48 params.m_Entity = item;
49 params.m_GameInventory = item.GetInventory();
50 params.m_SlotId = slotId;
51 params.m_CallerMethod =
"OnItemAttached";
66 LogMessage(
string.Format(
"parent:%1 entity:%2 (slot:%3)", parent, entity,
InventorySlots.GetSlotName(slotId)),
"OnItemDetached");
72 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
73 params.m_Entity = item;
74 params.m_GameInventory = item.GetInventory();
75 params.m_SlotId = slotId;
76 params.m_CallerMethod =
"OnItemDetached";
87 if (!item.GetHierarchyParent())
93 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
94 newItemAttributes.m_Entity = entity;
95 newItemAttributes.m_Parent = item.GetHierarchyParent();
96 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
100 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoIn");
103 Insert(category, newItemAttributes);
106 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
107 params.m_Entity = item;
108 params.m_GameInventory = item.GetInventory();
109 params.m_CallerMethod =
"OnItemCargoIn";
123 #ifdef ENABLE_LOGGING
124 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoOut");
130 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
131 params.m_Entity = item;
132 params.m_GameInventory = item.GetInventory();
133 params.m_CallerMethod =
"OnItemCargoOut";
143 CachedItemAttributesPerCategory attachmentAttributesPerCategory = ProcessAttachments(params);
146 foreach (CachedEquipmentItemAttribute attachmentAttribute : attachmentAttributes)
149 Insert(attachmentCategory, attachmentAttribute);
151 Remove(attachmentCategory, attachmentAttribute.m_Entity);
155 CachedItemAttributesPerCategory cargoAttributesPerCategory = ProcessCargo(params);
158 foreach (CachedEquipmentItemAttribute cargoAttribute : cargoAttributes)
161 Insert(cargoCategory, cargoAttribute);
163 Remove(cargoCategory, cargoAttribute.m_Entity);
176 CachedItemAttributesPerCategory attachmentAttributesPerCategory =
new CachedItemAttributesPerCategory();
178 int attachments = params.m_GameInventory.AttachmentCount();
179 for (
int attachmentIndex = 0; attachmentIndex < attachments; ++attachmentIndex)
181 EntityAI attachment = params.m_GameInventory.GetAttachmentFromIndex(attachmentIndex);
189 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
190 newItemAttributes.m_Entity = attachment;
191 newItemAttributes.m_Parent = attachment.GetHierarchyParent();
192 newItemAttributes.m_InventoryDepth = attachment.GetHierarchyLevel();
193 newItemAttributes.m_SlotIndex = params.m_SlotId;
196 array<ref CachedEquipmentItemAttribute> arr;
197 if (!attachmentAttributesPerCategory.Find(category, arr))
199 arr =
new array<ref CachedEquipmentItemAttribute>();
200 attachmentAttributesPerCategory.Set(category, arr);
203 #ifdef ENABLE_LOGGING
204 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, attachment),
string.Format(
"%1:ProcessAttachments", params.m_CallerMethod));
207 arr.Insert(newItemAttributes);
210 return attachmentAttributesPerCategory;
221 CachedItemAttributesPerCategory cargoAttributesPerCategory =
new CachedItemAttributesPerCategory();
222 if (params.m_GameInventory.GetCargo())
224 int cargoCount = params.m_GameInventory.GetCargo().GetItemCount();
225 for (
int cargoIndex = 0; cargoIndex < cargoCount; ++cargoIndex)
227 EntityAI cargo = params.m_GameInventory.GetCargo().GetItem(cargoIndex);
235 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
237 newItemAttributes.m_Entity = cargo;
238 newItemAttributes.m_Parent = cargo.GetHierarchyParent();
239 newItemAttributes.m_InventoryDepth = cargo.GetHierarchyLevel();
242 array<ref CachedEquipmentItemAttribute> arr;
243 if (!cargoAttributesPerCategory.Find(category, arr))
245 arr =
new array<ref CachedEquipmentItemAttribute>();
246 cargoAttributesPerCategory.Set(category, arr);
249 #ifdef ENABLE_LOGGING
250 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, cargo),
string.Format(
"%1:ProcessCargo", params.m_CallerMethod));
253 arr.Insert(newItemAttributes);
257 return cargoAttributesPerCategory;
262 #ifdef ENABLE_LOGGING
263 private void LogMessage(
string message,
string method)
265 #ifdef CACHED_EQUIPMENT_STORAGE_LOGGING
void CachedEquipmentStorage(DayZPlayerImplement player)
void ProcessItemInventory(CachedEquipmentStorageInventoryEntry params)
void OnItemCargoOut(notnull Entity entity)
void OnItemAttached(notnull Entity entity, int slotId, notnull Entity parent)
void Insert(ECachedEquipmentItemCategory category, CachedEquipmentItemAttribute attributes)
void OnItemDetached(notnull Entity entity, int slotId, notnull Entity parent)
void OnItemCargoIn(notnull Entity entity)
void Remove(ECachedEquipmentItemCategory category, Entity entity)
script counterpart to engine's class Inventory
provides access to slot configuration
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
ECachedEquipmentItemCategory
ECachedEquipmentOperationMode
ECachedEquipmentPlacement