Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ArsenalItemListConfig.c
Go to the documentation of this file.
1 [BaseContainerProps(configRoot:true)]
3 {
4  [Attribute("", UIWidgets.Object)]
5  protected ref array<ref SCR_ArsenalItemStandalone> m_aArsenalItems;
6 
7  protected ref map<SCR_EArsenalItemType, ref array<SCR_ArsenalItem>> m_mArsenalItemsByType = new map<SCR_EArsenalItemType, ref array<SCR_ArsenalItem>>();
8 
9  //------------------------------------------------------------------------------------------------
12  bool GetArsenalItems(out array<ref SCR_ArsenalItemStandalone> arsenalItems)
13  {
14  arsenalItems = m_aArsenalItems;
15  return arsenalItems != null && !arsenalItems.IsEmpty();
16  }
17 
18  //------------------------------------------------------------------------------------------------
23  bool GetItemTypeAndModeForPrefab(ResourceName prefab, out SCR_EArsenalItemType itemType, out SCR_EArsenalItemMode itemMode)
24  {
25  if (SCR_StringHelper.IsEmptyOrWhiteSpace(prefab))
26  return false;
27 
28  for (int i = 0, count = m_aArsenalItems.Count(); i < count; i++)
29  {
30  SCR_ArsenalItem item = m_aArsenalItems[i];
31  if (item.GetItemResourceName() == prefab)
32  {
33  itemType = item.GetItemType();
34  itemMode = item.GetItemMode();
35  return true;
36  }
37  }
38  return false;
39  }
40 
41  //------------------------------------------------------------------------------------------------
43  // \param filter Combined flags for available items for this faction (RIFLE, MAGAZINE, EQUIPMENT, RADIOBACKPACK etc.)
48  array<SCR_ArsenalItem> GetFilteredArsenalItems(SCR_EArsenalItemType typeFilter, SCR_EArsenalItemMode modeFilter, EArsenalItemDisplayType requiresDisplayType = -1)
49  {
50  array<SCR_ArsenalItem> filteredItems = new array<SCR_ArsenalItem>();
51 
52  array<SCR_ArsenalItem> itemsByType = m_mArsenalItemsByType.Get(typeFilter);
53  if (!itemsByType)
54  {
55  itemsByType = new array<SCR_ArsenalItem>();
56  array<ref SCR_ArsenalItemStandalone> availableArsenalItems;
57  if (GetArsenalItems(availableArsenalItems))
58  {
59  for (int i = 0, count = availableArsenalItems.Count(); i < count; i++)
60  {
61  //~ Ignore if no required display data
62  if (requiresDisplayType != -1 && !availableArsenalItems[i].GetDisplayDataOfType(requiresDisplayType))
63  continue;
64 
65  if (availableArsenalItems[i].GetItemType() & typeFilter)
66  {
67  itemsByType.Insert(availableArsenalItems[i]);
68  }
69  }
70 
71  m_mArsenalItemsByType.Insert(typeFilter, itemsByType);
72  }
73  }
74 
75  foreach (SCR_ArsenalItem item : itemsByType)
76  {
77  if (item.GetItemMode() & modeFilter)
78  filteredItems.Insert(item);
79  }
80 
81  return filteredItems;
82  }
83 
84  //------------------------------------------------------------------------------------------------
88  bool GetItemModeForPrefab(ResourceName prefab, out SCR_EArsenalItemType itemMode)
89  {
90  for (int i = 0, count = m_aArsenalItems.Count(); i < count; i++)
91  {
92  SCR_ArsenalItem item = m_aArsenalItems[i];
93  if (item.GetItemResourceName() == prefab)
94  {
95  itemMode = item.GetItemMode();
96  return true;
97  }
98  }
99  return false;
100  }
101 }
SCR_ArsenalItemListConfig
Definition: SCR_ArsenalItemListConfig.c:2
SCR_EArsenalItemMode
SCR_EArsenalItemMode
Definition: SCR_EArsenalItemMode.c:1
GetDisplayDataOfType
SCR_ArsenalItemDisplayData GetDisplayDataOfType(EArsenalItemDisplayType displayType)
Definition: SCR_ArsenalItem.c:57
SCR_StringHelper
Definition: SCR_StringHelper.c:1
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition: SCR_EArsenalItemType.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetItemType
SCR_EArsenalItemType GetItemType()
Definition: SCR_ArsenalItem.c:24
SCR_ArsenalItem
Definition: SCR_ArsenalItem.c:2
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468