470 {
471 TypeAttachmentGroupsDataHolder holder = target.GetTypeAttachmentGroupInfoHolder();
473 if (!dataArray)
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();
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 }
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'.