6 [
Attribute(uiwidget: UIWidgets.Auto,
desc:
"Fuel Tank IDs\nLeave empty to collect total fuel")]
7 protected ref array<int> m_aFuelTankIDs;
9 [
Attribute(defvalue:
"10", uiwidget: UIWidgets.Auto,
desc:
"Reserve fuel error level\n[%]",
params:
"0 100 0")]
10 protected float m_fReserveFuelLevel;
12 [
Attribute(defvalue:
"25", uiwidget: UIWidgets.Auto,
desc:
"Low fuel warning level\n[%]",
params:
"0 100 0")]
13 protected float m_fLowFuelLevel;
16 protected FuelManagerComponent m_pFuelManager;
17 protected ref array<BaseFuelNode> m_aFuelTanks = {};
21 override bool IsBlinking()
23 SCR_FuelNode scrFuelTank;
26 scrFuelTank = SCR_FuelNode.Cast(fuelTank);
27 if (scrFuelTank && scrFuelTank.GetLeakableFuel() > 0)
37 #ifdef SHOW_DMG_INDICATORS_ERROR
41 #ifdef SHOW_DMG_INDICATORS_WARNING
53 if (m_aFuelTanks.IsEmpty())
55 fuel = m_pFuelManager.GetTotalFuel();
56 maxFuel = m_pFuelManager.GetTotalMaxFuel();
63 fuel += fuelTank.GetFuel();
64 maxFuel += fuelTank.GetMaxFuel();
73 if (fuel <= m_fReserveFuelLevel * 0.01)
75 else if (fuel <= m_fLowFuelLevel * 0.01)
77 else if (IsBlinking())
84 override bool DisplayStartDrawInit(IEntity owner)
90 return super.DisplayStartDrawInit(owner);
95 override void DisplayInit(IEntity owner)
97 super.DisplayInit(owner);
99 m_pFuelManager = FuelManagerComponent.Cast(owner.FindComponent(FuelManagerComponent));
101 array<BaseFuelNode> fuelTanks = {};
102 int count = m_pFuelManager.GetFuelNodesList(fuelTanks);
104 if (m_aFuelTankIDs.IsEmpty())
106 m_aFuelTanks.InsertAll(fuelTanks);
110 foreach (
int fuelTankID : m_aFuelTankIDs)
112 if (fuelTanks.IsIndexValid(fuelTankID))
113 m_aFuelTanks.Insert(fuelTanks[fuelTankID]);