Drivetrain Module Reference
Module defined in `lua/vehicle/drivetrain.lua`. Legacy compatibility proxy that mirrors modern powertrain and controller data into the old drivetrain API format. Exists to support older mods and scripts that read drivetrain state directly. New code should use the `powertrain` and `controller` modules instead.
Module defined in lua/vehicle/drivetrain.lua. Legacy compatibility proxy that mirrors modern powertrain and controller data into the old drivetrain API format. Exists to support older mods and scripts that read drivetrain state directly. New code should use the powertrain and controller modules instead.
See Also
- Powertrain: Modern powertrain system.
- Backwards Compatibility: For legacy system translation.
State Fields
| Variable | Description |
|---|---|
avgAV, engineAV | Angular velocities (rad/s). |
brake, throttle, engineLoad | Inputs and load coefficients (0.0-1.0). |
engineDisabled | True if stalled or broken. |
esc | Table for ESC placeholders. Modern stability control is handled by the Driving Dynamics Controller. |
fuel, fuelCapacity, fuelLeakRate, fuelUsage | Energy storage and consumption metrics (L, L/s). Actual storage is managed by Energy Storage. |
gear, rpm, shifterMode, shifterPosition | Powertrain logic state. Modern implementations use Powertrain Devices and Shift Logic Controllers. |
wheelCount | Detected drive wheels. |
Public API
| Function | Signature | Description |
|---|---|---|
init | () (**hook**) | Link setup. |
reset | () (**hook**) | Variable reset. |
setShifterMode | (v) (**callable**) | Gearbox behavior control. |
shiftToGear | (gear) (**callable**) | Requests gear change. |
updateGFX | () (**hook**) | Modern-to-legacy data sync. |
Usage Example
-- Legacy code (avoid in new projects):
local rpm = drivetrain.rpm
local gear = drivetrain.gear
-- Modern equivalent:
local rpm = electrics.values.rpm
local gear = electrics.values.gearDamageTracker Module Reference
Module defined in `lua/vehicle/damageTracker.lua`. This is the centralized system for reporting component damage and failure states. It handles update throttling to the UI and manages temporary damage
Electrics Module Reference
Module defined in `lua/vehicle/electrics.lua`. This module manages the vehicle's electrical systems, including lights, signals, horn, ignition states, and various sensor-derived values. It acts as the