Bränsle & förbrukning
Fuel & consumption
Fuel types
Four ship by default. The key is what every vehicle, pump and station price refers to.
Config.FuelTypes = {
gasoline = { label = 'Gasoline', colour = '#e0973f', wholesale = 0.90, price = 2.00, electric = false },
diesel = { label = 'Diesel', colour = '#3fd07f', wholesale = 0.70, price = 1.50, electric = false },
premium = { label = 'Premium', colour = '#5b6cf0', wholesale = 1.40, price = 3.00, electric = false },
electric = { label = 'Electric', colour = '#41b8c9', wholesale = 2.10, price = 4.50, electric = true },
}| Field | Meaning |
|---|---|
wholesale |
What the owner pays per litre when ordering stock |
price |
The per-litre price a new station opens at. Owners change their own on the Fuel types page |
electric |
Bills by kWh at a charger instead of by litre at a pump |
Config.FuelOrder sets the order they appear in on the in-world selector.
What a vehicle drinks
Resolved in this order: the model is in Config.VehicleFuel.Electric → an exact match in Config.VehicleFuel.Model → its vehicle class in Config.VehicleFuel.Class → gasoline.
Config.VehicleFuel = {
Class = {
[0] = 'gasoline', [1] = 'gasoline', [2] = 'diesel', [3] = 'gasoline',
[4] = 'premium', [5] = 'gasoline', [6] = 'premium', [7] = 'premium',
[8] = 'gasoline', [9] = 'diesel', [10] = 'diesel', [11] = 'diesel',
[12] = 'diesel', [17] = 'diesel', [18] = 'diesel', [19] = 'diesel',
[20] = 'diesel',
},
Model = {
-- ['sultanrs'] = 'premium',
},
Electric = {
'voltic', 'voltic2', 'surge', 'neon', 'omnisegt', 'cyclone', 'tezeract',
'imorgon', 'dilettante', 'dilettante2', 'khamelion', 'raiden', 'iwagen',
'rcbandito', 'caddy', 'airtug',
},
}Anything in the Electric list only works at a charger — a pump refuses it.
Tank sizes
Litres a full tank holds, per class. 0 means that class never needs fuel — cycles (13) and trains (21) ship that way.
Config.Consumption.Tank = {
[0] = 45, [1] = 60, [2] = 75, [3] = 55, [4] = 70, [5] = 55, [6] = 65,
[7] = 80, [8] = 15, [9] = 80, [10] = 300, [11] = 90, [12] = 90,
[13] = 0, [14] = 200, [15] = 400, [16] = 500, [17] = 90, [18] = 90,
[19] = 150, [20] = 120, [21] = 0,
}
Config.Consumption.Default = 65Fuel is tracked as a percentage on the vehicle, so the tank size decides how far one percent goes. A 300-litre industrial truck loses percentage far more slowly per litre poured than a 15-litre motorcycle.
Burn rate
Two things multiply together: a per-class rate and the RPM band the engine is currently sitting in.
Config.Consumption.Rate = {
[0] = 0.6, [2] = 1.2, [4] = 1.6, [6] = 1.4, [7] = 2.0, [8] = 0.4,
[10] = 3.0, [15] = 3.5, [16] = 4.0,
}
Config.Consumption.RateDefault = 1.0
Config.Consumption.Rpm = {
[1.0] = 0.13, [0.9] = 0.10, [0.8] = 0.08, [0.7] = 0.065, [0.6] = 0.05,
[0.5] = 0.04, [0.4] = 0.03, [0.3] = 0.022, [0.2] = 0.015, [0.1] = 0.008,
[0.0] = 0.0,
}
Config.Consumption.Tick = 1000The RPM table does most of the work. Every tick the engine's current RPM is matched to the highest band at or below it, and that many litres come out, scaled by the class rate and the tank size. Flooring a Super burns roughly sixteen times what idling a compact does. Consumption only runs for the driver of a vehicle with the engine running, so parked cars and passengers cost nothing.
At zero fuel the engine cuts out.
To make fuel a lighter touch across the board, scale the whole Rpm table down — halve every value and everything on the server lasts twice as long, with the relative differences between vehicles intact.
Low-fuel warning
Config.Consumption.LowWarning = 15
Config.Consumption.LowWarningSound = true
Config.Consumption.WarnTick = 2000
Config.Consumption.IdleTick = 3000Below LowWarning percent the driver gets a notification and, optionally, a chime. It fires once per vehicle, not once per tick, so it never nags.
Spawn fuel
Config.Consumption.SpawnFuel = { min = 40, max = 80 }This is the single biggest dial on the fuel economy. Every vehicle the script has never seen before — every parked NPC car, every garage spawn, every admin-spawned vehicle — rolls a random level in this range the first time anyone looks at it.
Leave it at 40–80 and most cars a player finds are already half full, so refuelling is occasional. Drop it to { min = 5, max = 25 } and the pumps get busy immediately. Set both to 100 and nobody ever needs to fill up a fresh car.
Once a vehicle has been seen, its level lives on the entity state bag and is shared between clients from there, so it does not re-roll.
Wrong fuel
Pouring diesel into a petrol car, or a jerry can into an electric one, has consequences. The mode is server-wide, and an admin can override it per station from /fueladmin.
Config.WrongFuel = {
Mode = 'damage',
SlowPower = 0.45,
SlowSeconds = 45,
DamagePerLitre = 30,
BreakHealth = 150,
Grace = 3,
}| Mode | What happens |
|---|---|
off |
Nothing. Any fuel goes in any car |
slow |
The engine keeps only SlowPower of its power for SlowSeconds seconds, then recovers on its own |
damage |
Engine health drops by DamagePerLitre per litre of wrong fuel. It dies at -4000, so at the default it takes well over a hundred litres to kill outright |
break |