Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
FuelConsumptionSystem.c
Go to the documentation of this file.
2{
3 override static void InitInfo(WorldSystemInfo outInfo)
4 {
5 outInfo
6 .SetAbstract(false)
7 .AddPoint(ESystemPoint.FixedFrame);
8 }
9
10 protected ref array<SCR_FuelConsumptionComponent> m_Components = {};
11
12 //------------------------------------------------------------------------------------------------
13 override bool ShouldBePaused()
14 {
15 return true;
16 }
17
18 //------------------------------------------------------------------------------------------------
19 protected override void OnUpdatePoint(WorldUpdatePointArgs args)
20 {
21 float timeSlice = args.GetTimeSliceSeconds();
22
23 foreach (SCR_FuelConsumptionComponent comp: m_Components)
24 {
25 comp.Update(timeSlice);
26 }
27 }
28
29 //------------------------------------------------------------------------------------------------
30 protected override void OnDiag(float timeSlice)
31 {
32 DbgUI.Begin("FuelConsumptionSystem");
33
34 DbgUI.Text("Items: " + m_Components.Count());
35
36 if (DbgUI.Button("Dump active components"))
37 {
38 foreach (SCR_FuelConsumptionComponent comp: m_Components)
39 {
40 Print(comp.GetOwner(), LogLevel.ERROR);
41 }
42 }
43
44 DbgUI.End();
45 }
46
47 //------------------------------------------------------------------------------------------------
49 void Register(SCR_FuelConsumptionComponent component)
50 {
51 //About to be deleted
52 if (component.GetOwner().IsDeleted() || (component.GetOwner().GetFlags() & EntityFlags.USER5))
53 return;
54
55 if (m_Components.Find(component) != -1)
56 return;
57
58 m_Components.Insert(component);
59 }
60
61 //------------------------------------------------------------------------------------------------
62 void Unregister(SCR_FuelConsumptionComponent component)
63 {
64 int idx = m_Components.Find(component);
65 if (idx == -1)
66 return;
67
68 m_Components.Remove(idx);
69 }
70}
Definition DbgUI.c:66
void Unregister(SCR_FuelConsumptionComponent component)
override void OnDiag(float timeSlice)
ref array< SCR_FuelConsumptionComponent > m_Components
override void OnUpdatePoint(WorldUpdatePointArgs args)
void Register(SCR_FuelConsumptionComponent component)
Structure holding world system meta-information required by the engine.
Structure holding extra data of WorldSystem update point.
WorldSystemPoint ESystemPoint
Definition gameLib.c:7
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
EntityFlags
Various entity flags.
Definition EntityFlags.c:14