Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GameCoresManager.c
Go to the documentation of this file.
1
3
7[BaseContainerProps(configRoot: true)]
9{
10 protected static const ResourceName CORE_CONFIG_PATH = "{A9ACCDC72AD70995}Configs/Core/Cores.conf";
11
12 [Attribute()]
13 protected ref array<ref SCR_GameCoreBase> m_aCores;
14
15 protected ref array<SCR_GameCoreBase> m_CoresSorted = new array<SCR_GameCoreBase>;
17
19 {
20 foreach (SCR_GameCoreBase core: m_CoresSorted)
21 {
22 if (core)
23 core.OnAfterInit();
24 }
25 }
27 {
28 foreach (SCR_GameCoreBase core: m_CoresSorted)
29 {
30 if (core)
31 core.OnGameStart();
32 }
33 }
35 {
36 foreach (SCR_GameCoreBase core: m_CoresSorted)
37 {
38 if (core)
39 core.OnWorldPostProcess(world);
40 }
41 }
42 void OnUpdate(float timeSlice)
43 {
44 foreach (SCR_GameCoreBase core: m_CoresSorted)
45 {
46 if (core)
47 core.OnUpdate(timeSlice);
48 }
49 }
50 void OnGameEnd()
51 {
52 foreach (SCR_GameCoreBase core: m_CoresSorted)
53 {
54 if (core)
55 core.OnGameEnd();
56 }
57 }
59 {
60 foreach (SCR_GameCoreBase core: m_CoresSorted)
61 {
62 if (core)
63 core.OnBeforeWorldCleanup();
64 }
65 }
66
72 static SCR_GameCoreBase GetCore(typename type)
73 {
74 return m_CoresMap.Get(type);
75 }
76
81 {
82 Resource container = BaseContainerTools.LoadContainer(CORE_CONFIG_PATH);
83 if (!container || !container.IsValid())
84 {
85 Print(string.Format("Core config '%1' not found!", CORE_CONFIG_PATH), LogLevel.ERROR);
86 return null;
87 }
88
89 Managed instance = BaseContainerTools.CreateInstanceFromContainer(container.GetResource().ToBaseContainer());
90 SCR_GameCoresManager manager = SCR_GameCoresManager.Cast(instance);
91 if (!manager)
92 {
93 Print(string.Format("SCR_GameCoresManager class not found in '%1'!", CORE_CONFIG_PATH), LogLevel.ERROR);
94 delete instance;
95 return null;
96 }
97
98 return manager;
99 }
101 {
103 foreach (SCR_GameCoreBase core: m_aCores)
104 {
105 if (!core.IsEnabled() || !core.CanCreate())
106 continue;
107
108 if (!m_CoresMap.Contains(core.Type()))
109 {
110 //--- Add by priority
111 int priority = core.GetPriority();
112 int index = 0;
113 for (int c = 0, count = m_CoresSorted.Count(); c < count; c++)
114 {
115 index = c;
116 if (priority > m_CoresSorted[c].GetPriority())
117 break;
118 }
119 m_CoresSorted.InsertAt(core, index);
120 m_CoresMap.Insert(core.Type(), core);
121 }
122 else
123 {
124 Print(string.Format("Duplicate definition of core '%1'!", core.Type()), LogLevel.ERROR);
125 }
126 }
127
128 OnAfterInit();
129 }
130};
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
EDamageType type
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
ref array< ref SCR_GameCoreBase > m_aCores
void OnUpdate(float timeSlice)
static const ResourceName CORE_CONFIG_PATH
static SCR_GameCoreBase GetCore(typename type)
void OnWorldPostProcess(World world)
static SCR_GameCoresManager CreateCoresManager()
ref array< SCR_GameCoreBase > m_CoresSorted
static ref map< typename, SCR_GameCoreBase > m_CoresMap
Definition World.c:16
Definition Types.c:486
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
SCR_FieldOfViewSettings Attribute