Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityCatalogEntry.c
Go to the documentation of this file.
1
4[BaseContainerProps(), BaseContainerCustomDoubleCheckIntResourceNameTitleField("m_bEnabled", "m_sEntityPrefab", 1, "%1", "DISABLED - %1")]
6{
7 [Attribute(desc: "Prefab of entity", UIWidgets.ResourcePickerThumbnail, params: "et")]
9
10 [Attribute("1", desc: "Allows to disable the Entity data. It will be removed from the array on init if it is disabled and can never be obtained. Used for specific gamemodes and modding.")]
11 protected bool m_bEnabled;
12
13 [Attribute(desc: "List of specific Data for the entity. Each element should be an unique class (Unless all but one are disabled). This list is static and should not be changed in runtime.")]
14 protected ref array<ref SCR_BaseEntityCatalogData> m_aEntityDataList;
15
16 //~ Index within catalog. Set by Catalog
17 protected int m_iCatalogIndex = -1;
18
19 //~ UI Info that is obtained from the Prefab data.
21
22 //~ Reference to parent catalog this entry is part of
24
25 //======================================== GETTERS AND SETTERS ========================================\\
26 //--------------------------------- Is Enabled ---------------------------------\\
27
31 bool IsEnabled()
32 {
33 return m_bEnabled;
34 }
35
36 //--------------------------------- Get Index ---------------------------------\\
37
42 {
43 return m_iCatalogIndex;
44 }
45
46 //--------------------------------- Get Prefab ---------------------------------\\
47
52 {
53 return m_sEntityPrefab;
54 }
55
56 //--------------------------------- Get Catalog Parent ---------------------------------\\
57
65
66 //======================================== UI INFO ========================================\\
67 //--------------------------------- Get UI Info ---------------------------------\\
68
78
79 //--------------------------------- Get Name ---------------------------------\\
80
86 {
87 if (!GetEntityUiInfo())
88 return string.Empty;
89
90 return GetEntityUiInfo().GetName();
91 }
92
93 //======================================== LABELS ========================================\\
94 //--------------------------------- Get all Labels ---------------------------------\\
95
101 int GetEditableEntityLabels(notnull out array<EEditableEntityLabel> editableEntityLables)
102 {
103 editableEntityLables.Clear();
104
106 if (!editableUiInfo)
107 return 0;
108
109 return editableUiInfo.GetEntityLabels(editableEntityLables);
110 }
111
112 //--------------------------------- Has Label ---------------------------------\\
113
120 {
122 if (!editableUiInfo)
123 return false;
124
125 return editableUiInfo.HasEntityLabel(editableEntityLabel);
126 }
127
128 //--------------------------------- Has Any label ---------------------------------\\
129
135 bool HasAnyEditableEntityLabels(notnull array<EEditableEntityLabel> editableEntityLables)
136 {
138 if (!editableUiInfo)
139 return false;
140
141 foreach (EEditableEntityLabel label: editableEntityLables)
142 {
143 if (editableUiInfo.HasEntityLabel(label))
144 return true;
145 }
146
147 return false;
148 }
149
150 //--------------------------------- Has all labels ---------------------------------\\
151
157 bool HasAllEditableEntityLabels(notnull array<EEditableEntityLabel> editableEntityLables)
158 {
160 if (!editableUiInfo)
161 return false;
162
163 foreach (EEditableEntityLabel label: editableEntityLables)
164 {
165 if (!editableUiInfo.HasEntityLabel(label))
166 return false;
167 }
168
169 return true;
170 }
171
172 //======================================== DATA LISTS ========================================\\
173 //--------------------------------- Get Entity Data from type ---------------------------------\\
174
181 {
182 foreach (SCR_BaseEntityCatalogData entityData: m_aEntityDataList)
183 {
184 //~ Check if correct type and not disabled
185 if (entityData.IsEnabled() && entityData.Type().IsInherited(dataType))
186 return entityData;
187 }
188
189 return null;
190 }
191
192 //--------------------------------- Get Entity Data list ---------------------------------\\
193
199 int GetEntityDataList(notnull out array<SCR_BaseEntityCatalogData> entityDataList)
200 {
201 //~ Clear Given list
202 entityDataList.Clear();
203
204 //~ Copy list
205 foreach (SCR_BaseEntityCatalogData entityData: m_aEntityDataList)
206 {
207 //~ Ignore if disabled
208 if (entityData.IsEnabled())
209 entityDataList.Insert(entityData);
210 }
211
212 return entityDataList.Count();
213 }
214
215 //--------------------------------- Has Entity Data from type ---------------------------------\\
216
222 bool HasEntityDataOfType(typename dataType)
223 {
224 foreach (SCR_BaseEntityCatalogData entityData: m_aEntityDataList)
225 {
226 //~ Check if correct type and not disabled
227 if (entityData.IsEnabled() && entityData.Type().IsInherited(dataType))
228 return true;
229 }
230
231 return false;
232 }
233
240 bool HasAllEntityDataOfTypes(array<typename> dataTypes)
241 {
242 //~ Check for each data type if type exist. Return false if it does not
243 foreach (typename dataType: dataTypes)
244 {
245 if (!HasEntityDataOfType(dataType))
246 return false;
247 }
248
249 return true;
250 }
251
258 bool HasAnyEntityDataOfTypes(array<typename> dataTypes)
259 {
260 //~ Check for each data type if type exist. Return true if it has any in the given list
261 foreach (typename dataType: dataTypes)
262 {
263 if (HasEntityDataOfType(dataType))
264 return true;
265 }
266
267 return false;
268 }
269
270 //======================================== INIT ========================================\\
271 //--------------------------------- Class Specific Init ---------------------------------\\
272
278 void InitEntry(notnull SCR_EntityCatalog catalog, int catalogIndex)
279 {
280 //~ Set idexes for easy getting the entry from the catalog
281 if (GetCatalogIndex() == -1)
282 m_iCatalogIndex = catalogIndex;
283
284 //~ Set Catalog Reference
285 m_CatalogParent = catalog;
286
287 //~ Class Specific Init
289
290 //~ Init the data found in the list (Do last)
291 array<SCR_BaseEntityCatalogData> entityDataList = {};
292 GetEntityDataList(entityDataList);
293 foreach (SCR_BaseEntityCatalogData data: entityDataList)
294 {
295 data.InitData(this);
296 }
297 }
298
299 //--------------------------------- Class Specific Post Init ---------------------------------\\
300
306 {
307 array<SCR_BaseEntityCatalogData> entityDataList = {};
308 GetEntityDataList(entityDataList);
309 foreach (SCR_BaseEntityCatalogData data: entityDataList)
310 {
311 data.PostInitData(this);
312 }
313 }
314
315 //--------------------------------- Class Specific Init ---------------------------------\\
316 //~ This is a class specific init. Override and call any specific init functionality that should only be executed in the specific class
317 //~ Gets UIInfo from editable entity in base class
318 protected void ClassSpecificInit()
319 {
320 //~ Already has Init called
321 if (m_EditableEntityUiInfo != null)
322 return;
323
324 //~ Load Prefab
325 Resource entityPrefab = Resource.Load(GetPrefab());
326 if (!entityPrefab)
327 return;
328
329 //~ Get entity source
330 IEntitySource entitySource = SCR_BaseContainerTools.FindEntitySource(entityPrefab);
331 if (!entitySource)
332 return;
333
334 //~ Get EditableEntity component
336 if (!editableEntitySource)
337 return;
338
339 //~ Save UI Info found on Editable Enity
341 }
342};
EEditableEntityLabel
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_EditableEntityVariantData BaseContainerCustomDoubleCheckIntResourceNameTitleField("m_bEnabled", "m_sVariantPrefab", 1, "%1", "DISABLED - %1")
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
static IEntityComponentSource GetEditableEntitySource(Resource entityResource)
bool HasEntityLabel(EEditableEntityLabel label)
int GetEntityLabels(out notnull array< EEditableEntityLabel > entityLabels)
Get prefab entity Data of type Ignores disabled Data s param dataType class of Data type you with to obtain return Entity Data of given type Null if not found *SCR_BaseEntityCatalogData GetEntityDataOfType(typename dataType)
Get Index of entry within Catalog return index *int GetCatalogIndex()
bool HasAnyEntityDataOfTypes(array< typename > dataTypes)
Get list of entity Data of all types Ignores Disabled Elements param[out] Array of enabled entity Data list return List size *int GetEntityDataList(notnull out array< SCR_BaseEntityCatalogData > entityDataList)
Check if entity has given label Prefab needs to be an editable entity param editableEntityLabel Label to check if entity has it return True if entity has the label *bool HasEditableEntityLabel(EEditableEntityLabel editableEntityLabel)
Post Init for general entry Called one frame after init is called Only set by Catalog parent on post init Should not be overwritten param[i] catalog Catalog entry is in *void PostInitEntry(SCR_EntityCatalog catalog)
Check if has the entity data of the given type Ignores disabled Data s param dataType class of Data type you want to check return True if the entity has an enabled data of given type *bool HasEntityDataOfType(typename dataType)
Get Catalog parent the entity entry is in return Catalog parent *SCR_EntityCatalog GetCatalogParent()
Get UI info Prefab needs to be an editable entity or have a custom UI info logic Note that if UIInfo is NULL then the autotest will fail return Ui info *SCR_UIInfo GetEntityUiInfo()
bool m_bEnabled
bool HasAllEntityDataOfTypes(array< typename > dataTypes)
SCR_EntityCatalog m_CatalogParent
Init for general entry Setting index and called class specific init Only set by Catalog parent on init Should not be overwritten param catalog Catalog entry is in param index Index within catalog *void InitEntry(notnull SCR_EntityCatalog catalog, int catalogIndex)
Get Name of entity Prefab needs to be an editable entity return empty string if no uiinfo was found *LocalizedString GetEntityName()
ref array< ref SCR_BaseEntityCatalogData > m_aEntityDataList
Check if entity has ALL of the given labels Prefab needs to be an editable entity param editableEntityLables Labels to check if entity has ALL of them return True if entity has ALL of the label *bool HasAllEditableEntityLabels(notnull array< EEditableEntityLabel > editableEntityLables)
Check if entity has any one of the given labels Prefab needs to be an editable entity param editableEntityLables Labels to check if entity has any of them return True if entity has any of the label *bool HasAnyEditableEntityLabels(notnull array< EEditableEntityLabel > editableEntityLables)
If is Enabled return If enabled or disabled *bool IsEnabled()
ResourceName m_sEntityPrefab
Get a list of all editable entity lables Prefab needs to be an editable entity param[out] List of all labels on entity return length of lable array *int GetEditableEntityLabels(notnull out array< EEditableEntityLabel > editableEntityLables)
int m_iCatalogIndex
Get Prefab data return Prefab data *ResourceName GetPrefab()
void ClassSpecificInit()
ref SCR_UIInfo m_EditableEntityUiInfo
SCR_FieldOfViewSettings Attribute