Fuel
This resource is intended to give greater control over vehicle fuel economy, while adding another layer of variation and tuning capabilities for our upcoming vehicle tuning resource.
- Different fuel types, each defined with different “stats”, e.g: “knock rating”, “efficiency rating”, “power rating”.
- Each vehicle class has a configurable “economy” value, allowing you to effect the drain rate of each vehicle class individually (think: motorcycles drain fuel slower then sports cars).
- Each vehicle class has a configurable “tank size” value. This modifies the amount of time it takes to completely drain a vehicles fuel tank (works in conjunction with class economy above). This value also simulates an increased tank size by effecting how long it will take to refuel, and all subsequent fuel “labels” will represent a modified value (e.g: a vehicle with 1.0 tank modifier will read 100 units max, a 3.5 rating would read 350 units max).
- Straight-forward usage-by-rpm modifier.
- Realistic fuel nozzle and hose props that attach nicely to all types of vehicles.
- Addon fuel pumps, allowing you to create special locations for electric vehicle charging, or race fuel restocking, allowing only a given type of fuel.
- Proper electric vehicle handling (electric vehicles can only be charged by electric stations, proper “recharging/refueling” labels, etc).
- Purchase and use jerry cans with specific fuel types for emergency refills.
- Purchase and use battery boosters for an emergency electric-vehicle fuel boost.
- All jerry can/battery booster purchasing facilitated through pump interaction UI.
- Each fuel station has configurable “pump speeds” for added variation of refueling time.
- Each fuel station has configurable fuel types, with stock levels for each station that restock automatically given a configurable amount over-time.
- Station stock levels are stored between restarts.
- Exports provided to increase/reduce stock level at stations as required (if you wish to hook some type of fuel delivery trucking job up to this).
- Toggleable config option to explode pumps if player attempts to drive away while refueling with nozzle still attached to car.
Config
All of the config vars found below are stored within the config.lua
file.
Expand
config = {
-- Interact distance for players. Vehicle interact distance is 2x this.
interactDist = 2.5,
-- Hose distance, aka maximum distance for the nozzle to reach.
hoseDist = 5.0,
-- Minimum distance to stations to consider any actions.
renderDist = 25.0,
-- Size (litres) of a jerry can (or battery, for EVs).
jerryCanSize = 10.0,
-- How long it takes to refuel using a jerrycan (or battery).
jerryCanTime = 5000,
-- On refueling (nozzle attached to vehicle, actively pumping fuel), when player drives away with nozzle attached.
allowRefuelingExplosions = true,
-- Keep nozzle attached after explosion? May help police figure out who caused a petrol bowser explosion in the area.
keepNozzleAttached = true,
-- Controls how blips are displayed.
-- 0 = off
-- 1 = all on
-- 2 = display only closest
blipDisplay = 2,
-- Blip data.
blip = {
label = "Fuel Station",
sprite = 361,
color = 1,
alpha = 150,
scale = 0.5,
display = 2,
highDetail = true,
shortRange = true
},
-- How much fuel is drained per fuelDrainRate.
fuelDrainRate = 0.01,
-- How fast to drain fuel.
-- NOTE: With 1.0 fuelDrainRate, and 1000 fuelDrainTime, the drain rate for any vehicle (other modifiers not considered)
-- would equate to exactly 1% of your fuel being drained every 1000ms (1 second).
fuelDrainTime = 10000,
-- Base refuel rate.
-- Can be supplemented further with individual station pump speeds.
refuelAddRate = 5.0,
-- Fuel economy based on vehicle class
-- Lower = less fuel used
classEconomy = {
[0] = 0.5,
...
},
-- Fuel tank size based on vehicle class
-- Lower value = less time to burn max fuel reserve,
-- also less time to refuel vehicle at station.
classTank = {
[0] = 0.6,
...
},
-- How much fuel is used at given RPM
rpmUsage = {
[1.0] = 1.00,
...
},
electricVehicles = {
`Imorgon`,
...
},
}
Station Definition
For information on fuel station definitions and config options, read the documentation
All existing stations are already pre-configured within the data/stations.lua
file.
You can define new addon pumps in here.
Fuel Types
For information regarding fuel type definition and stat configuration, read the documentation
A working example can found in the data/fueltypes.lua
file.
Labels
All labels and translations can be found within the labels.lua
file.
Expand
labels = {
no_vehicles_nearby = "No vehicle nearby",
empty_driverseat_required = "Vehicle must not have a driver",
...
}
Usage
Check out the wiki for an update-to-date list of dependencies, conflicting resources, examples, and proper export documentation. You can otherwise contact me via DM for further instruction.
Code is accessible | No |
Subscription-based | No |
Lines (approximately) | 2000 + |
Requirements | ti_utils |
Support | Yes |