Vehicle Property & Module Tree
Quick reference for common object hierarchies and their access paths in Vehicle Lua.
Quick reference for common object hierarchies and their access paths in Vehicle Lua.
1. JBeam Data Structure (v.data)
Access via: v.data.[section]
These tables contain the parsed JBeam configuration for the vehicle.
| Section | Access Path | Description |
|---|---|---|
| Main Engine | v.data.mainEngine | JBeam settings for the primary engine. |
| Gearbox | v.data.gearbox | JBeam settings for the transmission. |
| Driveshaft | v.data.driveshaft | JBeam settings for the driveshaft. |
| Wheels | v.data.wheels | Configuration for all physical wheels. |
| Energy Storage | v.data.energyStorage | List of fuel tanks/batteries. |
| Controllers | v.data.controller | List of active Controllers. |
| Variables | v.data.variables | Current values of all JBeam $variables. |
2. The Engine Object (mainEngine)
Access via: local engine = powertrain.getDevice("mainEngine")
| Sub-Module / Property | Access Path | Description |
|---|---|---|
| Thermals | engine.thermals | Access to combustionEngineThermals (temps, damage). |
| Turbocharger | engine.turbocharger | Access to turbocharger module (boost, wastegate). |
| Supercharger | engine.supercharger | Access to supercharger module. |
| Nitrous (N2O) | engine.nitrousOxide | Access to nitrousOxide module. |
| Torque Curve | engine.torqueCurve | Raw table of RPM -> Torque. |
| Is Running? | not engine.isStalled and engine.outputAV1 > 0 | Check if engine is physically running. |
| Starter | engine:activateStarter() | Method to engage starter. |
3. The Gearbox Object (gearbox)
Access via: local gearbox = powertrain.getDevice("gearbox")
| Property / Method | Access Path | Description |
|---|---|---|
| Current Gear | gearbox.gearIndex | Integer of current gear. |
| Mode | gearbox.mode | "drive", "manual", "neutral", etc. |
| Shift Method | gearbox:shiftToGearIndex(i) | Force a gear change. |
4. Global Controllers
| Controller | Access Path | Description |
|---|---|---|
| Main Controller | controller.mainController | Primary driving logic (shifting, throttle). |
| ESC / TCS | controller.getController("esc") | Electronic Stability / Traction Control. |
5. Common Data Paths
- RPM:
electrics.values.rpm - Airspeed:
electrics.values.airspeed(m/s) - Wheel Speed:
electrics.values.wheelspeed(m/s) - Throttle Input:
electrics.values.throttle(0-1) - Brake Input:
electrics.values.brake(0-1) - Clutch Input:
electrics.values.clutch(0-1)
Powertrain Module Reference
Module defined in `lua/vehicle/powertrain.lua`. This is the physical powertrain simulation engine, managing the interconnected tree of [Devices](/docs/api/ve/powertrain/FOLDER_OVERVIEW) (engines, transmissions,
Props Module Reference
Module defined in `lua/vehicle/props.lua`. Manages animated vehicle "props" (steering wheels, needles, shifters, etc.).