Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
FuelConsumptionSystem.c
Go to the documentation of this file.
2 {
3  protected ref array<SCR_FuelConsumptionComponent> m_Components = {};
4 
5  protected override void OnUpdate(ESystemPoint point)
6  {
7  float timeSlice = GetWorld().GetFixedTimeSlice();
8 
9  foreach (SCR_FuelConsumptionComponent comp: m_Components)
10  {
11  comp.Update(timeSlice);
12  }
13  }
14 
15  //------------------------------------------------------------------------------------------------
16  protected override void OnDiag(float timeSlice)
17  {
18  DbgUI.Begin("FuelConsumptionSystem");
19 
20  DbgUI.Text("Items: " + m_Components.Count());
21 
22  if (DbgUI.Button("Dump active components"))
23  {
24  foreach (SCR_FuelConsumptionComponent comp: m_Components)
25  {
26  Print(comp.GetOwner(), LogLevel.ERROR);
27  }
28  }
29 
30  DbgUI.End();
31  }
32 
33  //------------------------------------------------------------------------------------------------
35  void Register(SCR_FuelConsumptionComponent component)
36  {
37  //About to be deleted
38  if (component.GetOwner().IsDeleted() || (component.GetOwner().GetFlags() & EntityFlags.USER5))
39  return;
40 
41  if (m_Components.Find(component) != -1)
42  return;
43 
44  m_Components.Insert(component);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  void Unregister(SCR_FuelConsumptionComponent component)
49  {
50  int idx = m_Components.Find(component);
51  if (idx == -1)
52  return;
53 
54  m_Components.Remove(idx);
55  }
56 }
FuelConsumptionSystem
Definition: FuelConsumptionSystem.c:1
GameSystem
Definition: GameSystem.c:12