Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EntityCatalogSpawnerData.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(configRoot: true), BaseContainerCustomCheckIntTitleField("m_bEnabled", "SpawnerData", "DISABLED - SpawnerData", 1)]
6 {
7  [Attribute(desc: "UI info overwrite to overwrite entity name. Will use EditableEntityUI if non is set")]
8  protected ref SCR_UIInfo m_UiInfo;
9 
10  [Attribute("0", desc: "Slot size the entity can be spawned in", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(SCR_EEntitySpawnerSlotType))]
11  protected SCR_EEntitySpawnerSlotType m_eSlotTypes;
12 
13  [Attribute(defvalue: "1", params: "1 inf", desc: "Prefab entity count. To be used with prefabs like groups, where spawned logic create additional entities")]
14  protected int m_iEntityCount;
15 
16  [Attribute(desc: "Variants prefab data of entity. These are a diffrent variant of the default")]
17  protected ref array<ref SCR_SpawnerVariantData> m_aVariantData;
18 
19  protected ResourceName m_sDefaultPrefab;
20 
21  protected SCR_ECharacterRank m_eMinimumRequiredRank;
22 
23  protected int m_iSupplyCost;
24 
25  //--------------------------------- Enable/Disable in Spawner ---------------------------------\\
26 
31  void SetEnabled(bool enable)
32  {
33  m_bEnabled = enable;
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  int GetEntityCount()
38  {
39  return m_iEntityCount;
40  }
41 
42  //--------------------------------- Get Overwrite name ---------------------------------\\
43 
48  LocalizedString GetOverwriteName()
49  {
50  if (!m_UiInfo)
51  return string.Empty;
52 
53  return m_UiInfo.GetName();
54  }
55 
56  //--------------------------------- Can Spawn in Slot ---------------------------------\\
57 
62  bool CanSpawnInSlot(SCR_EEntitySpawnerSlotType slotSize)
63  {
64  return SCR_Enum.HasFlag(GetValidSlotSizes(), slotSize);
65  }
66 
67  //--------------------------------- Get Valid slot sizes ---------------------------------\\
68 
72  SCR_EEntitySpawnerSlotType GetValidSlotSizes()
73  {
74  return m_eSlotTypes;
75  }
76 
77  //--------------------------------- Get has required Rank ---------------------------------\\
78 
84  bool HasRequiredRank(SCR_ECharacterRank rank)
85  {
86  if (rank == SCR_ECharacterRank.INVALID)
87  return false;
88 
89  return rank >= GetMinimumRequiredRank();
90  }
91 
92  //--------------------------------- Get minimum required Rank ---------------------------------\\
93 
97  SCR_ECharacterRank GetMinimumRequiredRank()
98  {
99  return m_eMinimumRequiredRank;
100  }
101 
102  //--------------------------------- Get supply cost ---------------------------------\\
103 
107  int GetSupplyCost()
108  {
109  return m_iSupplyCost;
110  }
111 
112  //--------------------------------- Get Variants of Type ---------------------------------\\
113 
117  ResourceName GetRandomDefaultOrVariantPrefab()
118  {
119  array<ResourceName> prefabs = {};
120 
121  prefabs.Insert(m_sDefaultPrefab);
122 
123  foreach (SCR_SpawnerVariantData data: m_aVariantData)
124  {
125  if (SCR_StringHelper.IsEmptyOrWhiteSpace(data.GetVariantPrefabData()))
126  continue;
127 
128  prefabs.Insert(data.GetVariantPrefabData());
129  }
130 
131  return prefabs.GetRandomElement();
132  }
133 
134  //--------------------------------- Get Variant data list ---------------------------------\\
135 
140  int GetVariantDataList(notnull out array<SCR_SpawnerVariantData> variantData)
141  {
142  variantData.Clear();
143 
144  foreach (SCR_SpawnerVariantData data: m_aVariantData)
145  {
146  variantData.Insert(data);
147  }
148 
149  return variantData.Count();
150  }
151 
152  //--------------------------------- Get Variant Prefab List ---------------------------------\\
153 
158  int GetVariantPrefabList(notnull out array<ResourceName> variantPrefabs)
159  {
160  variantPrefabs.Clear();
161 
162  foreach (SCR_SpawnerVariantData data: m_aVariantData)
163  {
164  variantPrefabs.Insert(data.GetVariantPrefabData());
165  }
166 
167  return variantPrefabs.Count();
168  }
169 
170  //--------------------------------- Get Variants of Type ---------------------------------\\
171 
176  SCR_SpawnerVariantData GetVariantDataOfType(ESpawnerVariantType variantType)
177  {
178  foreach (SCR_SpawnerVariantData data: m_aVariantData)
179  {
180  if (data.GetVariantType() == variantType)
181  return data;
182  }
183 
184  return null;
185  }
186 
187  //--------------------------------- Get Variant prefabs of Type ---------------------------------\\
188 
193  ResourceName GetVariantPrefabOfType(ESpawnerVariantType variantType)
194  {
195  SCR_SpawnerVariantData variantData = GetVariantDataOfType(variantType);
196 
197  if (!variantData)
198  return string.Empty;
199 
200  return variantData.GetVariantPrefabData();
201  }
202 
203  override void InitData(notnull SCR_EntityCatalogEntry entry)
204  {
205  super.InitData(entry);
206 
207  m_sDefaultPrefab = entry.GetPrefab();
208 
209  SCR_EditableEntityUIInfo uiInfo = SCR_EditableEntityUIInfo.Cast(entry.GetEntityUiInfo());
210  if (!uiInfo)
211  return;
212 
213  array<ref SCR_EntityBudgetValue> budgets = {};
214  uiInfo.GetEntityAndChildrenBudgetCost(budgets);
215 
216  m_eMinimumRequiredRank = -1;
217 
218  foreach (SCR_EntityBudgetValue budget : budgets)
219  {
220  switch (budget.GetBudgetType())
221  {
222  //~ Set Supply cost
223  case EEditableEntityBudget.CAMPAIGN:
224  {
225  m_iSupplyCost = budget.GetBudgetValue();
226 
227  break;
228  }
229 
230  //~ Set ranks
231  case EEditableEntityBudget.RANK_RENEGADE:
232  {
233  if (m_eMinimumRequiredRank == -1)
234  m_eMinimumRequiredRank = SCR_ECharacterRank.RENEGADE;
235  else
236  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
237 
238  break;
239  }
240  case EEditableEntityBudget.RANK_PRIVATE:
241  {
242  if (m_eMinimumRequiredRank == -1)
243  m_eMinimumRequiredRank = SCR_ECharacterRank.PRIVATE;
244  else
245  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
246 
247  break;
248  }
249  case EEditableEntityBudget.RANK_CORPORAL:
250  {
251  if (m_eMinimumRequiredRank == -1)
252  m_eMinimumRequiredRank = SCR_ECharacterRank.CORPORAL;
253  else
254  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
255 
256  break;
257  }
258  case EEditableEntityBudget.RANK_SERGEANT:
259  {
260  if (m_eMinimumRequiredRank == -1)
261  m_eMinimumRequiredRank = SCR_ECharacterRank.SERGEANT;
262  else
263  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
264 
265  break;
266  }
267  case EEditableEntityBudget.RANK_LIEUTENANT:
268  {
269  if (m_eMinimumRequiredRank == -1)
270  m_eMinimumRequiredRank = SCR_ECharacterRank.LIEUTENANT;
271  else
272  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
273 
274  break;
275  }
276  case EEditableEntityBudget.RANK_CAPTAIN:
277  {
278  if (m_eMinimumRequiredRank == -1)
279  m_eMinimumRequiredRank = SCR_ECharacterRank.CAPTAIN;
280  else
281  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
282 
283  break;
284  }
285  case EEditableEntityBudget.RANK_MAJOR:
286  {
287  if (m_eMinimumRequiredRank == -1)
288  m_eMinimumRequiredRank = SCR_ECharacterRank.MAJOR;
289  else
290  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
291 
292  break;
293  }
294  case EEditableEntityBudget.RANK_COLONEL:
295  {
296  if (m_eMinimumRequiredRank == -1)
297  m_eMinimumRequiredRank = SCR_ECharacterRank.COLONEL;
298  else
299  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
300 
301  break;
302  }
303  case EEditableEntityBudget.RANK_GENERAL:
304  {
305  if (m_eMinimumRequiredRank == -1)
306  m_eMinimumRequiredRank = SCR_ECharacterRank.GENERAL;
307  else
308  Print("'SCR_EntityCatalogSpawnerData' entry " + uiInfo.GetName() + " has rank " + typename.EnumToString(EEditableEntityBudget, m_eMinimumRequiredRank) + " assigned but multiple ranks in the editable UI info which is not supported!");
309 
310  break;
311  }
312  }
313  }
314 
315  //~ No rank set so set minimum rank
316  if (m_eMinimumRequiredRank == -1)
317  m_eMinimumRequiredRank = SCR_ECharacterRank.PRIVATE;
318  }
319 };
320 
321 //======================================== VARIANT DATA ========================================\\
322 
327 {
328  [Attribute(desc: "Prefab of Variant entity", params: "et")]
329  protected ResourceName m_sVariantPrefab;
330 
331  [Attribute("0", desc: "Type of variant. Type needs to be unique in the list", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(ESpawnerVariantType))]
332  protected ESpawnerVariantType m_eVehicleVariantType;
333 
338  ResourceName GetVariantPrefabData()
339  {
340  return m_sVariantPrefab;
341  }
342 
347  ESpawnerVariantType GetVariantType()
348  {
349  return m_eVehicleVariantType;
350  }
351 
352 };
353 
354 //======================================== ENUMS ========================================\\
355 
359 {
361 };
m_iSupplyCost
protected int m_iSupplyCost
Definition: SCR_ArsenalItem.c:9
SCR_Enum
Definition: SCR_Enum.c:1
SCR_EEntitySpawnerSlotType
SCR_EEntitySpawnerSlotType
Definition: SCR_EntitySpawnerSlotComponent.c:458
SCR_BaseContainerCustomTitleResourceName
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
Definition: SCR_CampaignMilitaryBaseComponent.c:2522
SCR_BaseEntityCatalogData
Definition: SCR_BaseEntityCatalogData.c:5
SCR_ECharacterRank
SCR_ECharacterRank
Definition: SCR_CharacterRankComponent.c:305
SCR_EditableEntityUIInfo
Definition: SCR_EditableEntityUIInfo.c:2
SCR_StringHelper
Definition: SCR_StringHelper.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
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
VEHICLE_MERC
@ VEHICLE_MERC
Definition: SCR_EntityCatalogSpawnerData.c:360
SCR_EntityBudgetValue
Definition: SCR_EntityBudgetValue.c:2
SCR_EntityCatalogSpawnerData
Definition: SCR_EntityCatalogSpawnerData.c:5
SCR_UIInfo
Definition: SCR_UIInfo.c:7
m_bEnabled
private bool m_bEnabled
Definition: SCR_BaseManualCameraComponent.c:3
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
ESpawnerVariantType
ESpawnerVariantType
Definition: SCR_EntityCatalogSpawnerData.c:358
LocalizedString
Definition: LocalizedString.c:21
SCR_EntityCatalogEntry
Definition: SCR_EntityCatalogEntry.c:5
SCR_SpawnerVariantData
Definition: SCR_EntityCatalogSpawnerData.c:326
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