Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ArsenalItem.c
Go to the documentation of this file.
1 [BaseContainerProps(configRoot: true), BaseContainerCustomCheckIntTitleField("m_bEnabled", "Arsenal Data", "DISABLED - Arsenal Data", 1)]
3 {
4  [Attribute("2", desc: "Type of the arsenal item. An arsenal will only spawn items of types that it allows to be spawned. The item will not show up if it is not allowed. Eg: FieldDressing = HEAL", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_EArsenalItemType))]
5  protected SCR_EArsenalItemType m_eItemType;
6 
7  [Attribute("2", desc: "Item mode of arsenal, set this to what the behaviour is for the item. EG: FieldDressing = CONSUMABLE as it is used up or M16 with attachments = WEAPON_VARIENTS as it is not a default M16. Check other items in the faction config to see how it works.", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_EArsenalItemMode))]
8  protected SCR_EArsenalItemMode m_eItemMode;
9 
10  [Attribute("10", desc: "Supply cost of item when using the resupply action and/or taking them from the arsenal inventory. Note in overwrite arsenal config this value is ignored and still taken from catalog", params: "0 inf 1")]
11  protected int m_iSupplyCost;
12 
13  [Attribute(desc: "Display data for SCR_ArsenalDisplayComponent. If Arsenal item has display data of the correct type for the entity with SCR_ArsenalDisplayComponent than it can be displayed on said entity")]
14  protected ref array<ref SCR_ArsenalItemDisplayData> m_aArsenalDisplayData;
15 
16  [Attribute(desc: "Depending on the settings of the arsenal component arsenal items can have an alternative supply cost. So it will take the cost of the alternative rather than the default cost. \n\nIf an Arsenal is not cost type default and the arsenal item does not have that cost type defined than it will still use the default cost.\n\nIf multiple entries have the same value than the last in the array will be used")]
17  protected ref array<ref SCR_ArsenalAlternativeCostData> m_aArsenalAlternativeCostData;
18 
19  protected ref map<SCR_EArsenalSupplyCostType, int> m_mArsenalAlternativeCostData;
20 
21  protected SCR_EntityCatalogEntry m_EntryParent;
22  protected ref Resource m_ItemResource;
23 
24  //------------------------------------------------------------------------------------------------
26  SCR_EArsenalItemType GetItemType()
27  {
28  return m_eItemType;
29  }
30 
31  //------------------------------------------------------------------------------------------------
33  SCR_EArsenalItemMode GetItemMode()
34  {
35  return m_eItemMode;
36  }
37 
38  //------------------------------------------------------------------------------------------------
40  ResourceName GetItemResourceName()
41  {
42  if (!m_EntryParent)
43  return string.Empty;
44 
45  return m_EntryParent.GetPrefab();
46  }
47 
48  //------------------------------------------------------------------------------------------------
50  Resource GetItemResource()
51  {
52  return m_ItemResource;
53  }
54 
55  //------------------------------------------------------------------------------------------------
59  SCR_ArsenalItemDisplayData GetDisplayDataOfType(EArsenalItemDisplayType displayType)
60  {
61  foreach (SCR_ArsenalItemDisplayData displayData : m_aArsenalDisplayData)
62  {
63  if (displayData.GetDisplayType() == displayType)
64  return displayData;
65  }
66 
67  return null;
68  }
69 
70  //--------------------------------- Direct Getter general or any faction ---------------------------------\\
71 
72  //------------------------------------------------------------------------------------------------
76  int GetSupplyCost(SCR_EArsenalSupplyCostType supplyCostType)
77  {
78  if (supplyCostType != SCR_EArsenalSupplyCostType.DEFAULT && m_mArsenalAlternativeCostData != null)
79  {
80  int returnValue;
81  if (m_mArsenalAlternativeCostData.Find(supplyCostType, returnValue))
82  return returnValue;
83  }
84 
85  return m_iSupplyCost;
86  }
87 
88  //------------------------------------------------------------------------------------------------
89  override void InitData(notnull SCR_EntityCatalogEntry entry)
90  {
91  m_EntryParent = entry;
92 
93  m_ItemResource = Resource.Load(m_EntryParent.GetPrefab());
94 
95  //~ Save alternative costs in map and delete the array
96  if (m_aArsenalAlternativeCostData.IsEmpty())
97  return;
98 
99  m_mArsenalAlternativeCostData = new map<SCR_EArsenalSupplyCostType, int>();
100 
101  foreach (SCR_ArsenalAlternativeCostData data : m_aArsenalAlternativeCostData)
102  {
103  //~ Ignore default as that is m_iSupplyCost defined in the arsenal item
104  if (data.m_eAlternativeCostType == SCR_EArsenalSupplyCostType.DEFAULT)
105  continue;
106 
107  m_mArsenalAlternativeCostData.Insert(data.m_eAlternativeCostType, data.m_iSupplyCost);
108  }
109 
110  //~ Delete array
112  }
113 }
114 
115 //------------------------------------------------------------------------------------------------
116 [BaseContainerProps(), BaseContainerCustomEnumWithValue(SCR_EArsenalSupplyCostType, "m_eAlternativeCostType", "m_iSupplyCost", "1", "%1 - Supply cost: %2")]
117 class SCR_ArsenalAlternativeCostData
118 {
119  [Attribute(SCR_EArsenalSupplyCostType.GADGET_ARSENAL.ToString(), desc: "Cost type if system searches for the cost. Do not use DEFAULT as this will be ignored", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_EArsenalSupplyCostType))]
120  SCR_EArsenalSupplyCostType m_eAlternativeCostType;
121 
122  [Attribute("1", desc: "Alternative supply cost", params: "0 inf")]
123  int m_iSupplyCost;
124 }
m_aArsenalAlternativeCostData
protected ref array< ref SCR_ArsenalAlternativeCostData > m_aArsenalAlternativeCostData
Definition: SCR_ArsenalItem.c:15
m_iSupplyCost
protected int m_iSupplyCost
Definition: SCR_ArsenalItem.c:9
SCR_BaseEntityCatalogData
Definition: SCR_BaseEntityCatalogData.c:5
SCR_EArsenalItemMode
SCR_EArsenalItemMode
Definition: SCR_EArsenalItemMode.c:1
m_eItemMode
protected SCR_EArsenalItemMode m_eItemMode
Definition: SCR_ArsenalItem.c:6
m_EntryParent
protected SCR_EntityCatalogEntry m_EntryParent
Definition: SCR_ArsenalItem.c:19
SCR_ArsenalItemDisplayData
Definition: SCR_ArsenalItemDisplayData.c:2
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
BaseContainerCustomEnumWithValue
SCR_ArsenalItem SCR_BaseEntityCatalogData BaseContainerCustomEnumWithValue(SCR_EArsenalSupplyCostType, "m_eAlternativeCostType", "m_iSupplyCost", "1", "%1 - Supply cost: %2")
Definition: SCR_ArsenalItem.c:116
m_ItemResource
protected ref Resource m_ItemResource
Definition: SCR_ArsenalItem.c:20
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition: SCR_EArsenalItemType.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
BaseContainerCustomCheckIntTitleField
Attribute for setting a custom format if the given checkVar is equal to checkVarEqual....
Definition: Attributes.c:659
BaseContainerProps
SCR_ArsenalItem SCR_BaseEntityCatalogData BaseContainerProps()
m_mArsenalAlternativeCostData
protected ref map< SCR_EArsenalSupplyCostType, int > m_mArsenalAlternativeCostData
Definition: SCR_ArsenalItem.c:17
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
m_eItemType
protected SCR_EArsenalItemType m_eItemType
Definition: SCR_ArsenalItem.c:3
SCR_ArsenalItem
Definition: SCR_ArsenalItem.c:2
SCR_EntityCatalogEntry
Definition: SCR_EntityCatalogEntry.c:5