DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ProcessAttachments()

map< ECachedEquipmentItemCategory, ref array< ref CachedEquipmentItemAttribute > > CachedEquipmentStorage::ProcessAttachments ( CachedEquipmentStorageInventoryEntry params)
inlineprivate

Processes attachments of item given through params.

Аргументы
paramsinventory item setting defined by CachedEquipmentStorageInventoryEntry
Возвращает
map containing ECachedEquipmentItemCategory and array of CachedEquipmentItemAttribute for further processing (cache insert/removal)

См. определение в файле CachedEquipmentStorage.c строка 176

177 {
178 CachedItemAttributesPerCategory attachmentAttributesPerCategory = new CachedItemAttributesPerCategory();
179
180 int attachments = params.m_GameInventory.AttachmentCount();
181 for (int attachmentIndex = 0; attachmentIndex < attachments; ++attachmentIndex)
182 {
183 EntityAI attachment = params.m_GameInventory.GetAttachmentFromIndex(attachmentIndex);
184 ECachedEquipmentItemCategory category = attachment.GetCachedEquipmentCategory();
185 if (category == ECachedEquipmentItemCategory.NONE)
186 continue;
187
188 if (params.m_OperationMode == ECachedEquipmentOperationMode.INSERT && IsStored(attachment, category))
189 continue;
190
191 InventoryLocation parentInventoryLocation = new InventoryLocation();
192 params.m_GameInventory.GetCurrentInventoryLocation(parentInventoryLocation);
193
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;
200 newItemAttributes.m_InventoryPlacement = ECachedEquipmentPlacement.ATTACHMENT;
201
202 array<ref CachedEquipmentItemAttribute> arr;
203 if (!attachmentAttributesPerCategory.Find(category, arr))
204 {
205 arr = new array<ref CachedEquipmentItemAttribute>();
206 attachmentAttributesPerCategory.Set(category, arr);
207 }
208
209 #ifdef ENABLE_LOGGING
210 LogMessage(string.Format("parent:%1 entity:%2", newItemAttributes.m_Parent, attachment), string.Format("%1:ProcessAttachments", params.m_CallerMethod));
211 #endif
212
213 arr.Insert(newItemAttributes);
214 }
215
216 return attachmentAttributesPerCategory;
217 }
class LogManager EntityAI
map CachedItemAttributesPerCategory
ECachedEquipmentItemCategory
Определения ECachedEquipmentItemCategory.c:2
ECachedEquipmentOperationMode
Определения ECachedEquipmentOperationMode.c:2
ECachedEquipmentPlacement
Определения ECachedEquipmentPlacement.c:2
bool IsStored(Entity entity, ECachedEquipmentItemCategory category)
Определения CachedEquipmentStorageBase.c:129
proto native int GetSlot()
returns slot id if current type is Attachment

Перекрестные ссылки InventoryLocation::GetSlot() и CachedEquipmentStorageBase::IsStored().

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