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

◆ FindSlotIdToAttachOrCombine()

int ActionAttachOnSelection::FindSlotIdToAttachOrCombine ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

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

21 {
22 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
23 if (targetEntity && item)
24 {
25 GameInventory inv = targetEntity.GetInventory();
26 if (!inv)
27 return InventorySlots.INVALID;
28
29 int slotsCount = item.GetInventory().GetSlotIdCount();
30 array<string> selections = new array<string>();
31 targetEntity.GetActionComponentNameList(target.GetComponentIndex(), selections);
32
33 foreach (string selection : selections)
34 {
35 int slotId = -1;
36 if (!targetEntity.TranslateSlotFromSelection(selection, slotId))
37 slotId = InventorySlots.GetSlotIdFromString(selection);
38
39 if (slotId == -1)
40 continue;
41
42 for (int i=0; i < slotsCount; ++i)
43 {
44 int itemSlotId = item.GetInventory().GetSlotId(i);
45 if (slotId == itemSlotId)
46 {
47 ItemBase currentAttachment = ItemBase.Cast(inv.FindAttachment(slotId));
48 if (currentAttachment)
49 {
50 if (currentAttachment.CanBeCombined(item))
51 return itemSlotId;
52 }
53 else
54 {
55 if (inv.CanAddAttachment(item))
56 return itemSlotId;
57 }
58 }
59 }
60 }
61 }
62
63 return InventorySlots.INVALID;
64 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
proto native bool CanAddAttachment(notnull EntityAI e)
Check if attachment can be added to any slot.
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61

Перекрестные ссылки ActionTarget, GameInventory::CanAddAttachment(), ItemBase::CanBeCombined(), GameInventory::FindAttachment(), InventorySlots::GetSlotIdFromString() и InventorySlots::INVALID.

Используется в ActionCondition() и SetupAction().