Fuel Module

Simulates fuel consumption based on engine power output and efficiency. The module calculates realistic fuel consumption using the engine's current power generation, maximum power, and thermodynamic efficiency.
Key Features
- Physically-based consumption calculation using engine power and efficiency
- Automatic engine shutdown when fuel depleted
- Real-time consumption metrics (L/100km, MPG, km/L)
- Idle consumption simulation
- Configurable consumption multiplier for gameplay balancing
Configuration
Basic Settings
| Property | Description |
|---|---|
Amount |
Current fuel in tank (liters). Automatically clamped between 0 and capacity |
Capacity |
Maximum tank capacity (liters). Motorcycles: 10-25 L, Compact cars: 35-50 L, Mid-size cars: 50-70 L, SUVs/Trucks: 70-120 L |
Consumption Parameters
| Property | Description |
|---|---|
Efficiency |
Thermal efficiency (0-1 range). Percentage of fuel energy converted to mechanical work. Gasoline engines: 0.25-0.35, Diesel engines: 0.35-0.45, Racing engines: 0.35-0.40 |
Idle Consumption |
Fuel consumption at idle as fraction of maximum (0-1 range). Economy cars: 0.05-0.08, Standard cars: 0.08-0.12, Performance cars: 0.12-0.20 |
Consumption Multiplier |
Multiplier for fuel consumption rate. Use for gameplay balancing without changing the physical model. 0.5 = Half consumption (double range), 1.0 = Realistic consumption, 2.0 = Double consumption (half range) |
Events
| Event | Description |
|---|---|
OnOutOfFuel |
Unity event triggered when tank becomes empty. Engine automatically stops when triggered |
Public Properties
Consumption Metrics (Read-Only)
| Property | Description |
|---|---|
ConsumptionLitersPer100Kilometers |
Current consumption in L/100km (European metric) |
ConsumptionMPG |
Current consumption in miles per gallon (US metric) |
ConsumptionKilometersPerLiter |
Current consumption in km/L |
ConsumptionLitersPerSecond |
Instantaneous fuel flow rate |
FuelPercentage |
Fuel level as percentage (0-1) |
HasFuel |
True if fuel available or module disabled |
Fuel Consumption Model
The model assumes gasoline with approximately 36 MJ/L energy content (10 kWh/L). Consumption is calculated from:
maxConsumptionPerHour = (engineMaxPower / 10) * (1 - efficiency)
consumptionPerHour = (generatedPower / maxPower) * maxConsumptionPerHour
Consumption is clamped to minimum idle consumption rate and adjusted by the consumption multiplier.