Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityCatalogManagerComponent.c
Go to the documentation of this file.
2[ComponentEditorProps(category: "GameScripted/GameMode/Components", description: "Manager for holding non-faction enities and to getter functions for entities from factions")]
6
7class SCR_EntityCatalogManagerComponent : SCR_BaseGameModeComponent
8{
9 [Attribute(desc: "List of non-faction related Entity catalogs. Each holds a list of entity Prefab and data of a given type. Catalogs of the same type are merged into one. Note this array is moved to a map on init and set to null")]
10 protected ref array<ref SCR_EntityCatalog> m_aEntityCatalogs;
11
12 //~ Catalog map for quicker obtaining the catalog using EEntityCatalogType
14
15 //~ Faction manager ref
17
18 //~ Instance
19 protected static SCR_EntityCatalogManagerComponent s_Instance;
20
21 protected static ref ScriptInvokerVoid s_OnEntityCatalogInitialized;
22
23 protected bool m_bInitDone;
24
25 //------------------------------------------------------------------------------------------------
27 static SCR_EntityCatalogManagerComponent GetInstance()
28 {
29 return s_Instance;
30 }
31
32 //------------------------------------------------------------------------------------------------
34 static ScriptInvokerVoid GetOnEntityCatalogInitialized()
35 {
36 if (!s_OnEntityCatalogInitialized)
37 s_OnEntityCatalogInitialized = new ScriptInvokerVoid();
38
39 return s_OnEntityCatalogInitialized;
40 }
41
42 //======================================== GET CATALOG ========================================\\
43
44 //------------------------------------------------------------------------------------------------
50 SCR_EntityCatalog GetEntityCatalogOfType(EEntityCatalogType catalogType, bool printNotFound = true)
51 {
52 //~ Init not yet called so initialize the factionless catalogs
53 if (!m_bInitDone)
54 Init();
55
56 //~ Get catalog
57 SCR_EntityCatalog entityCatalog = m_mEntityCatalogs.Get(catalogType);
58
59 if (entityCatalog)
60 return entityCatalog;
61
62 //~ No data found
63 if (printNotFound)
64 Print(string.Format("'SCR_EntityCatalogManagerComponent' trying to get entity list of type '%1' but there is no catalog with that type.", typename.EnumToString(EEntityCatalogType, catalogType)), LogLevel.WARNING);
65
66 return null;
67 }
68
69 //------------------------------------------------------------------------------------------------
76 SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, FactionKey factionKey, bool printNotFound = true)
77 {
79 return null;
80
81 SCR_Faction faction = SCR_Faction.Cast(m_FactionManager.GetFactionByKey(factionKey));
82 if (!faction)
83 {
84 Print(string.Format("'SCR_EntityCatalogManagerComponent', GetFactionEntityCatalogOfType could not get Catalog as faction '%1' is invalid or does not exist in current game", factionKey), LogLevel.ERROR);
85 return null;
86 }
87
88 return GetFactionEntityCatalogOfType(catalogType, faction, printNotFound);
89 }
90
91 //------------------------------------------------------------------------------------------------
98 SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, notnull SCR_Faction faction, bool printNotFound = true)
99 {
100 return faction.GetFactionEntityCatalogOfType(catalogType, printNotFound);
101 }
102
103 //======================================== GET ALL CATALOGS ========================================\\
104
105 //------------------------------------------------------------------------------------------------
110 int GetAllEntityCatalogs(notnull out array<SCR_EntityCatalog> outEntityCatalogs)
111 {
112 outEntityCatalogs.Clear();
113 foreach (SCR_EntityCatalog entityCatalog : m_mEntityCatalogs)
114 {
115 outEntityCatalogs.Insert(entityCatalog);
116 }
117
118 return outEntityCatalogs.Count();
119 }
120
121 //------------------------------------------------------------------------------------------------
128 int GetAllFactionEntityCatalogs(notnull out array<SCR_EntityCatalog> outEntityCatalogs, FactionKey factionKey)
129 {
130 if (!m_FactionManager)
131 return 0;
132
133 SCR_Faction faction = SCR_Faction.Cast(m_FactionManager.GetFactionByKey(factionKey));
134 if (!faction)
135 {
136 Print(string.Format("'SCR_EntityCatalogManagerComponent', GetAllFactionEntityCatalogs could not get Catalog as faction '%1' is invalid or does not exist in current game", factionKey), LogLevel.ERROR);
137 return 0;
138 }
139
140 return GetAllFactionEntityCatalogs(outEntityCatalogs, faction);
141 }
142
143 //------------------------------------------------------------------------------------------------
149 int GetAllFactionEntityCatalogs(notnull out array<SCR_EntityCatalog> outEntityCatalogs, notnull SCR_Faction faction)
150 {
151 return faction.GetAllFactionEntityCatalogs(outEntityCatalogs);
152 }
153
154 //======================================== GET SPECIFIC ENTRY WITH PREFAB ========================================\\
155
156 //------------------------------------------------------------------------------------------------
164 {
165 //~ No prefab given
166 if (SCR_StringHelper.IsEmptyOrWhiteSpace(prefabToFind))
167 return null;
168
169 //~ Get catalog
170 SCR_EntityCatalog catalog = GetEntityCatalogOfType(catalogType);
171 if (!catalog)
172 return null;
173
174 //~ Try and find prefab
175 return catalog.GetEntryWithPrefab(prefabToFind);
176 }
177
178 //------------------------------------------------------------------------------------------------
187 {
188 //~ No prefab given
189 if (SCR_StringHelper.IsEmptyOrWhiteSpace(prefabToFind))
190 return null;
191
192 //~ Get catalog
193 SCR_EntityCatalog catalog = GetFactionEntityCatalogOfType(catalogType, faction);
194 if (!catalog)
195 return null;
196
197 //~ Try and find prefab
198 return catalog.GetEntryWithPrefab(prefabToFind);
199 }
200
201 //------------------------------------------------------------------------------------------------
210 SCR_EntityCatalogEntry GetEntryWithPrefabFromGeneralOrFactionCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind, notnull SCR_Faction faction, bool prioritizeGeneralCatalog = false)
211 {
212 //~ No prefab given
213 if (SCR_StringHelper.IsEmptyOrWhiteSpace(prefabToFind))
214 return null;
215
216 SCR_EntityCatalogEntry foundEntry;
217
218 //~ Search in faction first
219 if (!prioritizeGeneralCatalog)
220 {
221 //~ Search in faction
222 foundEntry = GetEntryWithPrefabFromFactionCatalog(catalogType, prefabToFind, faction);
223 if (foundEntry)
224 return foundEntry;
225
226 //~ Search in general
227 foundEntry = GetEntryWithPrefabFromCatalog(catalogType, prefabToFind);
228 if (foundEntry)
229 return foundEntry;
230 }
231 //~ Search in general catalog first
232 else
233 {
234 //~ Search in faction
235 foundEntry = GetEntryWithPrefabFromCatalog(catalogType, prefabToFind);
236 if (foundEntry)
237 return foundEntry;
238
239 //~ Search in general
240 foundEntry = GetEntryWithPrefabFromFactionCatalog(catalogType, prefabToFind, faction);
241 if (foundEntry)
242 return foundEntry;
243 }
244
245 //~ Was not found
246 return null;
247 }
248
249 //------------------------------------------------------------------------------------------------
258 SCR_EntityCatalogEntry GetEntryWithPrefabFromAnyCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind, SCR_Faction priorityFaction = null, bool prioritizeGeneralOfPriorityFaction = false)
259 {
260 SCR_EntityCatalogEntry foundEntry;
261
262 if (!prioritizeGeneralOfPriorityFaction)
263 {
264 //~ Search in priority faction first
265 if (priorityFaction)
266 {
267 foundEntry = GetEntryWithPrefabFromFactionCatalog(catalogType, prefabToFind, priorityFaction);
268 if (foundEntry)
269 return foundEntry;
270 }
271
272 //~ Search in general
273 foundEntry = GetEntryWithPrefabFromCatalog(catalogType, prefabToFind);
274 if (foundEntry)
275 return foundEntry;
276 }
277 else
278 {
279 //~ Search in general first
280 foundEntry = GetEntryWithPrefabFromCatalog(catalogType, prefabToFind);
281 if (foundEntry)
282 return foundEntry;
283
284 //~ Search in priority faction
285 if (priorityFaction)
286 {
287 foundEntry = GetEntryWithPrefabFromFactionCatalog(catalogType, prefabToFind, priorityFaction);
288 if (foundEntry)
289 return foundEntry;
290 }
291 }
292
293 if (!m_FactionManager)
294 return null;
295
296 //~ Search all faction (ignoring priorityFaction) and try to find the prefab
297 array<Faction> factions = {};
298 m_FactionManager.GetFactionsList(factions);
299
300 foreach (Faction faction : factions)
301 {
302 SCR_Faction scrFaction = SCR_Faction.Cast(faction);
303
304 //~ SCR_Faction not found or already searched
305 if (!scrFaction || scrFaction == priorityFaction)
306 continue;
307
308 //~ Try and find the prefab
309 foundEntry = GetEntryWithPrefabFromFactionCatalog(catalogType, prefabToFind, scrFaction);
310 if (foundEntry)
311 return foundEntry;
312 }
313
314 return null;
315 }
316
317 //======================================== SPAWNER ========================================\\
318 //--------------------------------- Get List of valid prefabs for spawner ---------------------------------\\
319
330 int GetFilteredEditorPrefabsOfAllFactions(EEntityCatalogType catalogType, EEditorMode editorMode, notnull out array<ResourceName> filteredPrefabsList, array<EEditableEntityLabel> includedLabels = null, array<EEditableEntityLabel> excludedLabels = null, bool needsAllIncludedLabels = true, bool getFactionLessPrefabs = false)
331 {
332 filteredPrefabsList.Clear();
333
334 array<Faction> factions = {};
335
336 //~ Get sorted factions
338 if (delegateFactionManager)
339 {
340 SCR_SortedArray<SCR_EditableFactionComponent> sortedDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>();
341 int count = delegateFactionManager.GetSortedFactionDelegates(sortedDelegates);
342
343 //~ Get sorted factions
344 for(int i = 0; i < count; ++i)
345 {
346 factions.Insert(sortedDelegates.Get(i).GetFaction());
347 }
348
349 }
350 //~ No delegate found so get factions from faction manager
351 else if (m_FactionManager)
352 {
353 m_FactionManager.GetFactionsList(factions);
354 }
355 //~ Could not find faction nor faction manager
356 else
357 {
358 return 0;
359 }
360
361 array<ResourceName> filteredPrefabsOfFaction = {};
362 SCR_Faction scrFaction;
363 set<ResourceName> uniquePrefabs();
364
365 //~ Get filtered prefabs of each faction
366 foreach (Faction faction : factions)
367 {
368 scrFaction = SCR_Faction.Cast(faction);
369 if (!scrFaction)
370 continue;
371
372 GetFilteredEditorPrefabs(catalogType, editorMode, scrFaction, filteredPrefabsOfFaction, includedLabels, excludedLabels, needsAllIncludedLabels);
373 foreach (ResourceName prefab : filteredPrefabsOfFaction)
374 {
375 if (uniquePrefabs.Insert(prefab))
376 {
377 filteredPrefabsList.Insert(prefab);
378 }
379 else
380 {
381#ifdef ENABLE_DIAG
382 PrintFormat("SCR_EntityCatalogManagerComponent.GetFilteredEditorPrefabsOfAllFactions: Detected that %1 is present in at least two different faction entity catalogs! Since this may cause issues, such as dupliacted entries in build mode, one of them will be discarded! This is only supported for items. Other things require creation of faction specific variants.", SCR_FileIOHelper.GetShortResourceName(prefab), level: LogLevel.WARNING);
383#endif
384 }
385 }
386 }
387
388 //~ Get filtered prefabs of factionless entries
389 if (getFactionLessPrefabs)
390 {
391 GetFilteredEditorPrefabs(catalogType, editorMode, null, filteredPrefabsOfFaction, includedLabels, excludedLabels, needsAllIncludedLabels);
392 foreach (ResourceName prefab : filteredPrefabsOfFaction)
393 {
394 if (uniquePrefabs.Insert(prefab))
395 {
396 filteredPrefabsList.Insert(prefab)
397 }
398 else
399 {
400#ifdef ENABLE_DIAG
401 PrintFormat("SCR_EntityCatalogManagerComponent.GetFilteredEditorPrefabsOfAllFactions: Detected that %1 is present more than once in ! Since this may cause issues, such as dupliacted entries in build mode, one of them will be discarded! This is only supported for items. Other things require creation of faction specific variants.", SCR_FileIOHelper.GetShortResourceName(prefab), level: LogLevel.WARNING);
402#endif
403 }
404 }
405 }
406
407 return filteredPrefabsList.Count();
408 }
409
410 //--------------------------------- Get List of valid prefabs for spawner ---------------------------------\\
411
415 \param faction Faction (Optional) to get valid prefabs from
416 \param[out] filteredPrefabsList Filltered array of valid prefabs
417 \param includedLabels A list of labels the entity needs all/any to have. Can be null if any of the other arrays are filled
418 \param excludedLabels A list of labels the entity CANNOT have ANY of. Can be null if any of the other arrays are filled
419 \param needsAllIncludedLabels If true included List all needs to be true, if false any needs to be true
420 \return Size of found prefabs
421 */
422 int GetFilteredEditorPrefabs(EEntityCatalogType catalogType, EEditorMode editorMode, SCR_Faction faction, notnull out array<ResourceName> filteredPrefabsList, array<EEditableEntityLabel> includedLabels = null, array<EEditableEntityLabel> excludedLabels = null, bool needsAllIncludedLabels = true)
423 {
424 SCR_EntityCatalog catalog;
425 filteredPrefabsList.Clear();
426
427 //~ Get the catalog from faction or factionless
428 if (faction)
429 catalog = GetFactionEntityCatalogOfType(catalogType, faction);
430 else
431 catalog = GetEntityCatalogOfType(catalogType);
432
433 //~ No catalog found
434 if (!catalog)
435 return 0;
436
437 array<SCR_EntityCatalogEntry> filteredEntityList = {};
438 array<typename> filterClassArray = {};
439 filterClassArray.Insert(SCR_EntityCatalogEditorData);
440
441 catalog.GetFullFilteredEntityList(filteredEntityList, includedLabels, excludedLabels, filterClassArray, needsAllIncludedLabels: needsAllIncludedLabels);
442
444 set<ResourceName> uniquePrefabs();
445
446 //~ Get all valid prefabs for mode
447 foreach (SCR_EntityCatalogEntry entry : filteredEntityList)
448 {
449 editorData = SCR_EntityCatalogEditorData.Cast(entry.GetEntityDataOfType(SCR_EntityCatalogEditorData));
450
451 //~ Ignore entries not valid in current editor mode
452 if (!editorData.IsValidInEditorMode(editorMode))
453 continue;
454
455 ResourceName prefab = entry.GetPrefab();
456
457 //~ Add the prefab to the array
458 if (uniquePrefabs.Insert(prefab))
459 {
460 filteredPrefabsList.Insert(prefab);
461 }
462 else
463 {
464#ifdef ENABLE_DIAG
465 PrintFormat("SCR_EntityCatalogManagerComponent.GetFilteredEditorPrefabs: Detected that %1 is present in at least two different faction entity catalogs! Since this may cause issues, such as dupliacted entries in build mode, one of them will be discarded! This is only supported for items. Other things require creation of faction specific variants.", SCR_FileIOHelper.GetShortResourceName(entry.GetPrefab()), level: LogLevel.WARNING);
466#endif
467 }
468 }
469
470 return filteredPrefabsList.Count();
471 }
472
473 //======================================== ARSENAL ========================================\\
474
475 //------------------------------------------------------------------------------------------------
484 bool GetArsenalItems(out array<SCR_ArsenalItem> arsenalItems, SCR_EArsenalItemType typeFilter = -1, SCR_EArsenalItemMode modeFilter = -1, SCR_EArsenalGameModeType arsenalGameModeType = -1, EArsenalItemDisplayType requiresDisplayType = -1)
485 {
486 arsenalItems.Clear();
487
489 if (!itemCatalog)
490 return false;
491
492 return GetArsenalItems(arsenalItems, itemCatalog, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
493 }
494
495 //------------------------------------------------------------------------------------------------
505 bool GetFactionArsenalItems(out array<SCR_ArsenalItem> arsenalItems, SCR_Faction faction, SCR_EArsenalItemType typeFilter = -1, SCR_EArsenalItemMode modeFilter = -1, SCR_EArsenalGameModeType arsenalGameModeType = -1, EArsenalItemDisplayType requiresDisplayType = -1)
506 {
507 arsenalItems.Clear();
508
510 if (!itemCatalog)
511 return false;
512
513 return GetArsenalItems(arsenalItems, itemCatalog, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
514 }
515
516 //------------------------------------------------------------------------------------------------
525 protected bool GetArsenalItems(out array<SCR_ArsenalItem> arsenalItems, notnull SCR_EntityCatalog itemCatalog, SCR_EArsenalItemType typeFilter = -1, SCR_EArsenalItemMode modeFilter = -1, SCR_EArsenalGameModeType arsenalGameModeType = -1, EArsenalItemDisplayType requiresDisplayType = -1)
526 {
527 array<SCR_EntityCatalogEntry> arsenalEntries = {};
528 array<SCR_BaseEntityCatalogData> arsenalDataList = {};
529 itemCatalog.GetEntityListWithData(SCR_ArsenalItem, arsenalEntries, arsenalDataList);
530
531 SCR_ArsenalItem arsenalItem;
532
533 foreach (SCR_BaseEntityCatalogData arsenalData: arsenalDataList)
534 {
535 //~ Get Arsenal data
536 arsenalItem = SCR_ArsenalItem.Cast(arsenalData);
537
538 //~ Does not have type so skip
539 if (typeFilter != -1 && !SCR_Enum.HasPartialFlag(arsenalItem.GetItemType(), typeFilter))
540 continue;
541
542 //~ Does not have mode so skip
543 if (modeFilter != -1 && !SCR_Enum.HasPartialFlag(arsenalItem.GetItemMode(), modeFilter))
544 continue;
545
546 //~ Get if has display data, ignore if it doesn't
547 if (requiresDisplayType != -1 && !arsenalItem.GetDisplayDataOfType(requiresDisplayType))
548 continue;
549
550 //~ Only get items that have the given arsenal game mode type flag. (-1 means no restrictions)
551 if (arsenalGameModeType > 0 && !SCR_Enum.HasFlag(arsenalItem.GetArsenalGameModeTypes(), arsenalGameModeType))
552 continue;
553
554 arsenalItems.Insert(arsenalItem);
555 }
556
557 return !arsenalItems.IsEmpty();
558 }
559
560 //------------------------------------------------------------------------------------------------
569 int GetAllArsenalItems(out array<SCR_ArsenalItem> allArsenalItems, SCR_EArsenalItemType typeFilter = -1, SCR_EArsenalItemMode modeFilter = -1, SCR_EArsenalGameModeType arsenalGameModeType = -1, EArsenalItemDisplayType requiresDisplayType = -1)
570 {
571 allArsenalItems.Clear();
572
573 array<Faction> factions = {};
574 m_FactionManager.GetFactionsList(factions);
575 SCR_Faction scrFaction;
576 array<SCR_ArsenalItem> arsenalItems = {};
577
578 foreach (Faction faction : factions)
579 {
580 scrFaction = SCR_Faction.Cast(faction);
581 if (!scrFaction)
582 continue;
583
584 GetFactionArsenalItems(arsenalItems, scrFaction, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
585 allArsenalItems.InsertAll(arsenalItems);
586 }
587
588 GetArsenalItems(arsenalItems, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
589 allArsenalItems.InsertAll(arsenalItems);
590
591 return allArsenalItems.Count();
592 }
593
594 //------------------------------------------------------------------------------------------------
602 array<SCR_ArsenalItem> GetFilteredArsenalItems(SCR_EArsenalItemType typeFilter, SCR_EArsenalItemMode modeFilter, SCR_EArsenalGameModeType arsenalGameModeType, SCR_Faction faction = null, EArsenalItemDisplayType requiresDisplayType = -1)
603 {
604 array<SCR_ArsenalItem> refFilteredItems = {};
605 array<SCR_ArsenalItem> filteredItems = {};
606
607 if (faction)
608 GetFactionArsenalItems(refFilteredItems, faction, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
609 else
610 GetArsenalItems(refFilteredItems, typeFilter, modeFilter, arsenalGameModeType, requiresDisplayType);
611
612 foreach (SCR_ArsenalItem item : refFilteredItems)
613 {
614 filteredItems.Insert(item);
615 }
616
617 return filteredItems;
618 }
619
620 //======================================== IDENTITY ITEM ========================================\\
621 //------------------------------------------------------------------------------------------------
624 {
625 if (!character)
626 return GetDefaultIdentityItem();
627
628 FactionAffiliationComponent factionAffiliationComp = FactionAffiliationComponent.Cast(character.FindComponent(FactionAffiliationComponent));
629 if (!factionAffiliationComp)
630 return GetDefaultIdentityItem();
631
632 SCR_Faction faction = SCR_Faction.Cast(factionAffiliationComp.GetAffiliatedFaction());
633 if (!faction)
634 return GetDefaultIdentityItem();
635
637 if (!catalog)
638 return GetDefaultIdentityItem();
639
640 array<SCR_EntityCatalogEntry> filteredEntityList = {};
641
642 catalog.GetEntityListWithData(SCR_EntityCatalogIdentityItemData, filteredEntityList);
643 if (filteredEntityList.IsEmpty())
644 return string.Empty;
645
646 if (filteredEntityList.Count() > 1)
647 Print("SCR_EntityCatalogManagerComponent: GetIdentityItemForCharacter Multiple Identity Items found for faction " + faction.GetFactionKey() + "! Only the first found will be used");
648
649 return filteredEntityList[0].GetPrefab();
650 }
651
652 //------------------------------------------------------------------------------------------------
655 {
657 if (!catalog)
658 return string.Empty;
659
660 array<SCR_EntityCatalogEntry> filteredEntityList = {};
661
662 catalog.GetEntityListWithData(SCR_EntityCatalogIdentityItemData, filteredEntityList);
663 if (filteredEntityList.IsEmpty())
664 return string.Empty;
665
666 if (filteredEntityList.Count() > 0)
667 Print("SCR_EntityCatalogManagerComponent: GetIdentityItemForCharacter Multiple Identity Items found for factionless list! Only the first found will be used");
668
669 return filteredEntityList[0].GetPrefab();
670 }
671
672 //======================================== INIT ========================================\\
673 //------------------------------------------------------------------------------------------------
677 static void InitCatalogs(notnull array<ref SCR_EntityCatalog> entityCatalogArray, notnull map<EEntityCatalogType, ref SCR_EntityCatalog> entityCatalogMap)
678 {
679 SCR_EntityCatalog foundCatalog;
680
681 //~ Process all catalogs
682 foreach (SCR_EntityCatalog entityCatalog : entityCatalogArray)
683 {
684 //~ Catalog not part of map so add it
685 if (!entityCatalogMap.Find(entityCatalog.GetCatalogType(), foundCatalog))
686 entityCatalogMap.Insert(entityCatalog.GetCatalogType(), entityCatalog);
687 //~ Catalog is part of map so merge them
688 else
689 foundCatalog.MergeCatalogs(entityCatalog);
690 }
691
692 //~ Init the entries after merge
693 foreach (SCR_EntityCatalog entityCatalog : entityCatalogArray)
694 {
695 //~ Init the catalog
696 entityCatalog.InitCatalog();
697 }
698 }
699
700 //------------------------------------------------------------------------------------------------
701 override void EOnInit(IEntity owner)
702 {
703 if (!m_bInitDone)
704 Init();
705 }
706
707 //------------------------------------------------------------------------------------------------
708 protected void Init()
709 {
710 m_bInitDone = true;
711
712 m_FactionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
713 if (!m_FactionManager)
714 Debug.Error2("SCR_EntityCatalogManagerComponent", "Could not find SCR_FactionManager, this is required for many the Getter Functions!");
715
716 //~ Init the catalog
718
719 //~ Clear array as no longer needed
720 m_aEntityCatalogs = null;
721
722 if (s_OnEntityCatalogInitialized)
723 s_OnEntityCatalogInitialized.Invoke();
724 }
725
726 //------------------------------------------------------------------------------------------------
727 override void OnPostInit(IEntity owner)
728 {
730 return;
731
732 if (s_Instance)
733 {
734 Print("More than one 'SCR_EntityCatalogManagerComponent' excist in the world! Make sure there is only 1!", LogLevel.ERROR);
735 return;
736 }
737
738 //~ Set instance
739 s_Instance = this;
740
741 SetEventMask(owner, EntityEvent.INIT);
742 }
743}
override void Init()
EEntityCatalogType
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_EArsenalGameModeType
SCR_EArsenalItemMode
SCR_EArsenalItemType
Get all prefabs that have the spawner the given labels and are valid in the editor mode for all factions param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param[out] filteredPrefabsList Filltered array of valid prefabs param includedLabels A list of labels the entity needs all any to have Can be null if any of the other arrays are filled param excludedLabels A list of labels the entity CANNOT have ANY of Can be null if any of the other arrays are filled param needsAllIncludedLabels If true included List all needs to be if false any needs to be true param getFactionLessPrefabs If true than it will also get the prefabs not assigned to any faction return Size of found prefabs *int GetFilteredEditorPrefabsOfAllFactions(EEntityCatalogType catalogType, EEditorMode editorMode, notnull out array< ResourceName > filteredPrefabsList, array< EEditableEntityLabel > includedLabels=null, array< EEditableEntityLabel > excludedLabels=null, bool needsAllIncludedLabels=true, bool getFactionLessPrefabs=false)
SCR_EntityCatalogEntry GetEntryWithPrefabFromAnyCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind, SCR_Faction priorityFaction=null, bool prioritizeGeneralOfPriorityFaction=false)
int GetAllFactionEntityCatalogs(notnull out array< SCR_EntityCatalog > outEntityCatalogs, FactionKey factionKey)
SCR_EntityCatalogEntry GetEntryWithPrefabFromFactionCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind, notnull SCR_Faction faction)
SCR_EntityCatalogEntry GetEntryWithPrefabFromGeneralOrFactionCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind, notnull SCR_Faction faction, bool prioritizeGeneralCatalog=false)
bool GetFactionArsenalItems(out array< SCR_ArsenalItem > arsenalItems, SCR_Faction faction, SCR_EArsenalItemType typeFilter=-1, SCR_EArsenalItemMode modeFilter=-1, SCR_EArsenalGameModeType arsenalGameModeType=-1, EArsenalItemDisplayType requiresDisplayType=-1)
SCR_EntityCatalogEntry GetEntryWithPrefabFromCatalog(EEntityCatalogType catalogType, ResourceName prefabToFind)
int GetAllArsenalItems(out array< SCR_ArsenalItem > allArsenalItems, SCR_EArsenalItemType typeFilter=-1, SCR_EArsenalItemMode modeFilter=-1, SCR_EArsenalGameModeType arsenalGameModeType=-1, EArsenalItemDisplayType requiresDisplayType=-1)
int GetAllEntityCatalogs(notnull out array< SCR_EntityCatalog > outEntityCatalogs)
array< SCR_ArsenalItem > GetFilteredArsenalItems(SCR_EArsenalItemType typeFilter, SCR_EArsenalItemMode modeFilter, SCR_EArsenalGameModeType arsenalGameModeType, SCR_Faction faction=null, EArsenalItemDisplayType requiresDisplayType=-1)
SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, FactionKey factionKey, bool printNotFound=true)
ResourceName GetIdentityItemForCharacter(ChimeraCharacter character)
bool GetArsenalItems(out array< SCR_ArsenalItem > arsenalItems, SCR_EArsenalItemType typeFilter=-1, SCR_EArsenalItemMode modeFilter=-1, SCR_EArsenalGameModeType arsenalGameModeType=-1, EArsenalItemDisplayType requiresDisplayType=-1)
ResourceName GetDefaultIdentityItem()
SCR_EntityCatalog GetEntityCatalogOfType(EEntityCatalogType catalogType, bool printNotFound=true)
ref map< EEntityCatalogType, ref SCR_EntityCatalog > m_mEntityCatalogs
ref array< ref SCR_EntityCatalog > m_aEntityCatalogs
Definition SCR_Faction.c:81
void SCR_FactionManager(IEntitySource src, IEntity parent)
SCR_FactionManager m_FactionManager
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Definition Debug.c:13
SCR_EArsenalItemType GetItemType()
SCR_ArsenalItemDisplayData GetDisplayDataOfType(EArsenalItemDisplayType displayType)
SCR_EArsenalGameModeType GetArsenalGameModeTypes()
SCR_EArsenalItemMode GetItemMode()
static SCR_DelegateFactionManagerComponent GetInstance()
int GetSortedFactionDelegates(notnull out SCR_SortedArray< SCR_EditableFactionComponent > outDelegates)
Info for which editor modes the entity is added to.
bool IsValidInEditorMode(EEditorMode editorMode)
SCR_EntityCatalogEntry GetEntryWithPrefab(ResourceName prefabToFind)
Manager for non-faction specific entity catalogs as well as getters for faction specific catalogs.
SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, bool printNotFound=true)
static string GetShortResourceName(ResourceName rn)
static bool IsEditMode()
Definition Functions.c:1566
static bool IsEmptyOrWhiteSpace(string input)
Definition Types.c:486
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
EEditorMode
Editor mode that defines overall functionality.
Definition EEditorMode.c:6
EntityEvent
Various entity events.
Definition EntityEvent.c:14