7 [
Attribute(
"0",
desc:
"Type of display data an arsenal item needs in in order to be displayed on this arsenal display", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EArsenalItemDisplayType),
category:
"Display settings")]
8 protected EArsenalItemDisplayType m_eArsenalItemDisplayType;
10 [
Attribute(
"4",
desc:
"Refresh time in seconds. Every x time the arsenal will try to refresh")]
13 protected ref array<SCR_WeaponRackSlotEntity>
m_aSlots = {};
19 super.SetSupportedArsenalItemTypes(types);
26 super.SetSupportedArsenalItemModes(modes);
32 if (!slot ||
m_aSlots.Find(slot) != -1)
51 for (
int i = 0; i <
m_aSlots.Count(); i++)
67 array<SCR_ArsenalItem> filteredArsenalItems = {};
73 int availableItemCount = filteredArsenalItems.Count();
74 int availableSlotCount =
m_aSlots.Count();
78 for (
int i = 0; i < availableSlotCount; i++)
85 else if(currentSlot && currentSlot.GetChildren())
87 currentSlot.RemoveItem();
89 else if (!currentSlot)
96 if (!currentSlot.CanSpawnItem())
101 int index = i % availableItemCount;
102 for (
int j = 0; j < availableItemCount; j++)
104 itemToSpawn = filteredArsenalItems[
index];
105 if (
GetItemValidForSlot(itemToSpawn.GetItemType(), itemToSpawn.GetItemMode(), currentSlot.GetSlotSupportedItemTypes(), currentSlot.GetSlotSupportedItemModes()))
110 if (
index >= availableItemCount)
117 currentSlot.SpawnNewItem(itemToSpawn.GetItemResource(), itemToSpawn, itemToSpawn.GetDisplayDataOfType(m_eArsenalItemDisplayType));
127 if (slotEntity.GetChildren() && slotEntity.GetChildren().GetPrefabData())
130 return GetItemValidForSlot(slotEntity.GetCurrentOccupiedItemType(), slotEntity.GetCurrentOccupiedItemMode(), slotEntity.GetSlotSupportedItemTypes(), slotEntity.GetSlotSupportedItemModes());
139 return GetItemValid(itemType, itemMode) &&
SCR_Enum.HasPartialFlag(supportedSlotTypes, itemType) &&
SCR_Enum.HasPartialFlag(supportedSlotModes, itemMode);
145 super.EOnInit(owner);
147 IEntity child = owner.GetChildren();
154 child = child.GetSibling();
157 RplComponent rpl = RplComponent.Cast(owner.FindComponent(RplComponent));
158 if (!rpl || (rpl && rpl.Role() == RplRole.Authority))
173 super.OnPostInit(owner);
175 SetEventMask(owner, EntityEvent.INIT);
181 super.OnDelete(owner);