Skip to content

Electric charging

Electric charging

Electric vehicles ignore pumps entirely. They charge at a charge point, are billed by the kWh, and can also be topped up instantly with a battery item.

Where the chargers are

Each station's charger field is a vec4 — position and heading — where the charge point prop is placed. Stations without that field have no charger, and an EV cannot be served there.

config.lua
Config.Electric = {
    ChargerProp = 'prop_electric_01',
    CableProp   = 'prop_eletricpistol',
    Capacity = 60,
    Fast   = { kwhPerTick = 0.9, tick = 250 },
    Normal = { kwhPerTick = 0.5, tick = 250 },
    ChargeTarget   = 100,
    VehicleSearch  = 5.0,
    MaxDistance    = 6.0,
    TargetDistance = 2.5,
    ChargerSearch  = 3.0,
}

A cable model attaches from the charger to the car for the duration of the session, and detaches when it ends.

A charge session

  • Park the EV within VehicleSearch of the charger and interact with it.
  • The in-world panel shows the battery level, the kWh delivered so far, the running cost and the current speed.
  • [F] switches between fast and normal. Fast delivers 0.9 kWh per tick against normal's 0.5, for the same price per kWh — the choice is time, not money.
  • Charging stops at ChargeTarget percent, when you cancel, or when you walk more than MaxDistance away.
  • You pay for the kWh actually delivered, at the station's electric price.

The station is not stocked with electricity — an electric fuel has no tank to run dry, so it never needs a delivery run. It still earns the station money at whatever price the owner sets.

Pricing

The electric entry in Config.FuelTypes sets the numbers, and the owner changes their own sell price on the Fuel types page like any other fuel:

lua
electric = { label = 'Electric', colour = '#41b8c9', wholesale = 2.10, price = 4.50, electric = true },

Config.Electric.Capacity is how many kWh a full battery holds, which is what turns a percentage of battery into a bill.

Battery swap

An instant alternative to standing at the charger.

config.lua
Config.Electric.Battery = {
    Enabled = true,
    Item    = 'ev_battery',
    Price   = 180,
}

At a charger, the customer gets a swap battery option — a target entry, or [G] on the text prompt. It charges a flat Price, tops the car to full immediately, and the money goes into the station bank exactly like a normal sale.

Register ev_battery in your inventory the same way as the jerry can, minus the use handler — the charger consumes it, so it does not need to be useable.

Set Enabled = false to remove the option and force everyone to actually stand there and wait.

Marking a vehicle electric

Add its spawn name to Config.VehicleFuel.Electric. That list wins over both the model overrides and the class defaults, so a car in it can never be filled at a pump.