3 [
Attribute(
"#AR-SupportStation_Fuel_ActionInvalid_FuelFull",
desc:
"Text shown on action if fuel tank already full", uiwidget: UIWidgets.LocaleEditBox)]
6 [
Attribute(
"#AR-SupportStation_Fuel_ActionInvalid_FuelProviderNoFuel",
desc:
"There are fuel refuel stations near by but non have fuel in their tank", uiwidget: UIWidgets.LocaleEditBox)]
9 [
Attribute(
"#AR-SupportStation_Fuel_ActionInvalid_FuelCanisterEmpty",
desc:
"The player is holding a fuel canister but cannot refuel as it is empty", uiwidget: UIWidgets.LocaleEditBox)]
12 [
Attribute(
desc:
"IDs of fuel tanks linked to this refuel action. Leave empty if all fuel tanks are valid")];
13 protected ref array<int> m_aFuelTankIDs;
15 [
Attribute(
"1",
desc:
"Decimal count of action percentage. Put on 2 if the entity has a large fuel tank",
params:
"0 2")]
16 protected int m_iActionDecimalCount;
27 void GetFuelTankIDs(array<int> fuelTankIDs)
29 fuelTankIDs.Copy(m_aFuelTankIDs);
38 bool CheckIfFuelNodeIsValid(SCR_FuelNode fuelNode)
40 return !fuelNode || m_aFuelTankIDs.IsEmpty() || m_aFuelTankIDs.Contains(fuelNode.GetFuelTankID());
47 int GetValidFuelNodesCount()
49 return m_aFuelTankIDs.Count();
53 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
57 Print(
"'SCR_RefuelAtSupportStationAction': '" + pOwnerEntity.GetName() +
"' is missing SCR_FuelManager!", LogLevel.WARNING);
59 super.Init(pOwnerEntity, pManagerComponent);
67 return m_sInvalidFuelActionReason;
69 return m_sInvalidFullTank;
71 return m_sInvalidReasonFuelCanisterEmpty;
73 return super.GetInvalidPerformReasonString(reasonInvalid);
77 override bool CanBeShownScript(IEntity user)
82 return super.CanBeShownScript(user);
104 protected override bool PrioritizeHeldGadget()
110 override bool CanBePerformedScript(IEntity user)
112 bool canRefuel =
true;
120 if (m_aFuelTankIDs.IsEmpty())
129 array<BaseFuelNode> nodes = {};
131 SCR_FuelNode scrNode;
135 scrNode = SCR_FuelNode.Cast(node);
137 if (!CheckIfFuelNodeIsValid(scrNode))
140 if (node.GetFuel() < node.GetMaxFuel())
154 canRefuel = super.CanBePerformedScript(user);
159 protected override int GetActionDecimalCount()
161 return m_iActionDecimalCount;
165 protected override float GetActionPercentage()
170 float fuelPercentage;
173 array<BaseFuelNode> nodes = {};
175 SCR_FuelNode scrNode;
179 scrNode = SCR_FuelNode.Cast(node);
181 if (!CheckIfFuelNodeIsValid(scrNode))
184 fuelPercentage += node.GetFuel() / node.GetMaxFuel();
188 if (validFuelNodes <= 0)
191 return (fuelPercentage / validFuelNodes) * 100;