Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlaceableEntitiesRegistryFromCatalog.c
Go to the documentation of this file.
1 [BaseContainerProps(configRoot: true), BaseContainerCatalogPlacableEntitiesTitleField("m_eEditorMode", "m_eCatalogFactionType", "m_CatalogTypes")]
9 {
10  [Attribute("0", desc: "The editor mode that the catalog entry has assigned", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EEditorMode))]
11  protected EEditorMode m_eEditorMode;
12 
13  [Attribute("0", desc: "If the entries will be from factions, factionless or both", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_ECatalogFactionType))]
14  protected SCR_ECatalogFactionType m_eCatalogFactionType;
15 
16  [Attribute("0", UIWidgets.SearchComboBox, "", enums: ParamEnumArray.FromEnum(EEntityCatalogType))]
17  protected ref array<ref EEntityCatalogType> m_CatalogTypes;
18 
19  //------------------------------------------------------------------------------------------------
20  void Init()
21  {
22  if (m_CatalogTypes.IsEmpty())
23  return;
24 
25  SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
26  if (!catalogManager)
27  {
28  Print("SCR_PlaceableEntitiesRegistryFromCatalog cannot find SCR_EntityCatalogManagerComponent so can not initialize entries within Catalogs!", LogLevel.WARNING);
29  return;
30  }
31 
32  foreach (EEntityCatalogType catalogType: m_CatalogTypes)
33  {
34  ProcessCatalog(catalogType, catalogManager);
35  }
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  void ProcessCatalog(EEntityCatalogType catalogType, notnull SCR_EntityCatalogManagerComponent catalogManager)
40  {
41  array<ResourceName> prefabs = {};
42 
43  //~ Get correct filtered entities
44  if (m_eCatalogFactionType == SCR_ECatalogFactionType.FACTION_AND_FACTIONLESS)
45  catalogManager.GetFilteredEditorPrefabsOfAllFactions(catalogType, m_eEditorMode, prefabs, getFactionLessPrefabs: true);
46  else if (m_eCatalogFactionType == SCR_ECatalogFactionType.FACTIONS_ONLY)
47  catalogManager.GetFilteredEditorPrefabsOfAllFactions(catalogType, m_eEditorMode, prefabs, getFactionLessPrefabs: false);
48  else if (m_eCatalogFactionType == SCR_ECatalogFactionType.FACTIONLESS_ONLY)
49  catalogManager.GetFilteredEditorPrefabs(catalogType, m_eEditorMode, null, prefabs);
50 
51  AddPrefabs(prefabs);
52  }
53 
54  //------------------------------------------------------------------------------------------------
56  {
57  if (SCR_Global.IsEditMode())
58  return;
59 
60  Init();
61  }
62 };
63 
65 {
69 }
70 
71 class BaseContainerCatalogPlacableEntitiesTitleField : BaseContainerCustomTitle
72 {
73  protected string m_sEditorModeVar;
74  protected string m_sFactionTypeVar;
75  protected string m_sCatalogTypesListVar;
76 
77  //------------------------------------------------------------------------------------------------
78  void BaseContainerCatalogPlacableEntitiesTitleField(string editorModeVar, string factionTypeVar, string catalogTypesListVar)
79  {
80  m_sEditorModeVar = editorModeVar;
81  m_sFactionTypeVar = factionTypeVar;
82  m_sCatalogTypesListVar = catalogTypesListVar;
83  }
84 
85  //------------------------------------------------------------------------------------------------
86  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
87  {
88  EEditorMode editorMode;
89 
90  if (!source.Get(m_sEditorModeVar, editorMode))
91  return false;
92 
93  SCR_ECatalogFactionType factionType;
94 
95  if (!source.Get(m_sFactionTypeVar, factionType))
96  return false;
97 
98  array<EEntityCatalogType> catalogTypes = {};
99 
100  if (!source.Get(m_sCatalogTypesListVar, catalogTypes))
101  return false;
102 
103  title = "Catalog Getter (" + typename.EnumToString(EEditorMode, editorMode) + ")";
104 
105  string categories = "MISSING CATALOGS!";
106 
107  if (!catalogTypes.IsEmpty())
108  {
109  categories = string.Empty;
110 
111  for (int i = 0, count = catalogTypes.Count(); i < count; i++)
112  {
113  if (i > 0)
114  categories += " & ";
115 
116  categories += typename.EnumToString(EEntityCatalogType, catalogTypes[i]);
117  }
118  }
119 
120  title += " - " + categories + " - " + typename.EnumToString(SCR_ECatalogFactionType, factionType);
121 
122  return true;
123  }
124 }
FACTIONLESS_ONLY
@ FACTIONLESS_ONLY
Get entries from factionless Only.
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:68
BaseContainerCatalogPlacableEntitiesTitleField
void BaseContainerCatalogPlacableEntitiesTitleField(string editorModeVar, string factionTypeVar, string catalogTypesListVar)
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:78
_WB_GetCustomTitle
override bool _WB_GetCustomTitle(BaseContainer source, out string title)
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:86
EEntityCatalogType
EEntityCatalogType
Definition: EEntityCatalogType.c:4
FACTION_AND_FACTIONLESS
@ FACTION_AND_FACTIONLESS
Get entries from faction and factionless catalogs.
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:66
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
FACTIONS_ONLY
@ FACTIONS_ONLY
Get entries from factions only.
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:67
m_sCatalogTypesListVar
protected string m_sCatalogTypesListVar
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:75
SCR_ECatalogFactionType
SCR_ECatalogFactionType
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:64
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_sEditorModeVar
enum SCR_ECatalogFactionType m_sEditorModeVar
EEditorMode
EEditorMode
Editor mode that defines overall functionality.
Definition: EEditorMode.c:5
SCR_Global
Definition: Functions.c:6
SCR_PlaceableEntitiesRegistry
Definition: SCR_PlaceableEntitiesRegistry.c:8
SCR_PlaceableEntitiesRegistryFromCatalog
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:8
m_sFactionTypeVar
protected string m_sFactionTypeVar
Definition: SCR_PlaceableEntitiesRegistryFromCatalog.c:74
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