API ReferenceveenergyStorage
Fuel Tank Component
Logic defined in `lua/vehicle/energyStorage/fuelTank.lua`. Simulates a physical container for liquid fuels.
Logic defined in lua/vehicle/energyStorage/fuelTank.lua. Simulates a physical container for liquid fuels.
Exports
Functions
new(jbeamData) (factory)
-
Description: Creates a new fuel tank object.
-
JBeam Properties:
fuelCapacity: Total volume (L).energyType: "gasoline", "diesel", or "kerosene".fuelLiquidDensity: Density (kg/L).
-
Returns:
storage
Methods (on object)
updateGFX(dt): Recalculates remaining volume/ratio from stored energy, updates fuel node masses, and applies leak drain.onBreak(): Triggers a leak atbrokenLeakRate.setRemainingVolume(volume): Directly sets the fuel level (clamped to capacity).setRemainingRatio(ratio): Sets fuel level as a ratio (0.0-1.0) of total energy capacity.registerDevice(device): Associates a powertrain device (engine) with this storage.setPartCondition(odometer, integrity, visual): Restores tank state from saved data.integritycan be a number (0-1, maps to proportional fuel) or a table withstoredEnergyandcurrentLeakRate.getPartCondition(): Returns integrity state and value for serialization.
Related
beamstate: Often triggersonBreakvia beam breakage hooks.