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

◆ GetAttachmentSlotFromSelection()

int ConstructionActionData::GetAttachmentSlotFromSelection ( PlayerBase player,
EntityAI target,
ItemBase item_to_attach,
string selection )
inlineprotected

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

470 {
471 TypeAttachmentGroupsDataHolder holder = target.GetTypeAttachmentGroupInfoHolder();
472 array<TypeAttachmentGroupData> dataArray = holder.GetAttGroupsDataBySelectionParam(selection);
473 if (!dataArray) //no valid slot paired to the selection
474 return InventorySlots.INVALID;
475
476 foreach (TypeAttachmentGroupData data : dataArray)
477 {
478 if (data)
479 {
480 int slotId;
481 foreach (string slotName : data.m_AttSlots)
482 {
483 slotId = InventorySlots.GetSlotIdFromString(slotName);
484 GameInventory inventory = target.GetInventory();
485 EntityAI attachment = inventory.FindAttachment(slotId);
486
487 if ((inventory.CanAddAttachmentEx(item_to_attach, slotId)) || (attachment && attachment.CanBeCombined(item_to_attach)))
488 {
489 if(target.CanDisplayAttachmentSlot(slotId) && target.CanDisplayAttachmentCategory(data.GetAttachmentGroupClassName()))
490 return slotId;
491 }
492 }
493 }
494 }
495
496 return InventorySlots.INVALID;
497 }
class LogManager EntityAI
PlayerSpawnPreset slotName
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!...
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
array< TypeAttachmentGroupData > GetAttGroupsDataBySelectionParam(string selectionName)
Returns an array of 'GUIInventoryAttachmentsProps' subclasses that use the same 'selection'.

Перекрестные ссылки GameInventory::CanAddAttachmentEx(), GameInventory::FindAttachment(), TypeAttachmentGroupsDataHolder::GetAttGroupsDataBySelectionParam(), InventorySlots::GetSlotIdFromString(), InventorySlots::INVALID и slotName.

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