Drive Modes
Manages vehicle-wide driving profiles (e.g., Comfort, Sport, Eco) that simultaneously adjust multiple systems including engine response, transmission behavior, steering weight, exhaust sound, and suspension stiffness. Provides a unified interface for switching between pre-configured vehicle personalities.
Manages vehicle-wide driving profiles (e.g., Comfort, Sport, Eco) that simultaneously adjust multiple systems including engine response, transmission behavior, steering weight, exhaust sound, and suspension stiffness. Provides a unified interface for switching between pre-configured vehicle personalities.
State Fields
| Field | Type | Description |
|---|---|---|
name | string | Internal identifier for the drive mode controller. |
Public API
| Function | Description |
|---|---|
new(jbeamData) | Creates a new drive mode manager. |
setDriveMode(modeKey) | Applies all settings (engine, exhaust, gearbox, steering, etc.) associated with the target mode. |
nextDriveMode() | Cycles to the next available drive mode. |
getCurrentDriveModeKey() | Returns the key of the currently active drive mode. |
module.getDriveModeData(modeKey) | Returns the drive mode data. |
module.setSimpleControlButton(id, buttonUIName, icon, color, offColor, offColorElectric, onClick, remove) | Sets the simple control button. |
Hooks
| Hook | Description |
|---|---|
updateGFX(dt) | Updates UI indicators and manages mode transition effects. |
module.reset(jbeamData) | Resets the controller to its initial state. |
module.resetLastStage() | Final-stage reset after all controllers are reset. |
module.initLastStage(jbeamData) | Final-stage initialization after all controllers and powertrains are ready. |
Usage Example
-- Cycle to the next drive mode
controller.getController("driveModes").nextDriveMode()
-- Set a specific mode
controller.getController("driveModes").setDriveMode("sport")
-- Query current mode
local mode = controller.getController("driveModes").getCurrentDriveModeKey()See Also
- Vehicle Controller — Main powertrain logic affected by drive modes
- ESC — Stability control — may change per mode
- Control Modes — Input mapping profiles
Drag Timer
Precision timing controller for drag racing. Measures elapsed time and trap speed over standard drag racing distances (60ft, 330ft, 660ft, 1000ft, 1/4 mile, 1/2 mile). Integrates with the UI to display live timing data.
Dummy Controller
A minimal "Main" controller implementation that provides the required interface without any powertrain logic. Used for testing, props, or vehicles that don't need engine/transmission simulation (e.g., trailers, static objects). Maps raw inputs directly to electrics values.