API Referencevepowertrain
Powertrain Base Device
Base class inherited by all powertrain components. Provides common methods for locking, disabling, and querying device state. Every powertrain device shares these properties.
Base class inherited by all powertrain components (engines, gearboxes, differentials, shafts, wheels). Any method or property listed here is available on every powertrain device instance returned by powertrain.getDevice().
Common Properties
| Property | Type | Description |
|---|---|---|
device.inputAV | number | Angular velocity at the input (rad/s). |
device.outputAV1 | number | Angular velocity at output port 1 (rad/s). Additional ports: outputAV2, etc. |
device.outputTorque1 | number | Torque at output port 1 (Nm). Additional ports: outputTorque2, etc. |
device.isBroken | boolean | Whether the device has sustained catastrophic damage. |
device.cumulativeGearRatio | number | Total gear ratio from this device to the powertrain root. |
device.cumulativeInertia | number | Total rotational inertia (kg·m²) downstream of this device. |
Common Instance Methods
| Method | Signature | Description |
|---|---|---|
lockUp | device:lockUp() | Catastrophically locks the device, setting output AV to 0 and marking as broken. |
disable | device:disable() | Disables the device. A disabled device passes 0 torque. |
enable | device:enable() | Re-enables a previously disabled device. |
applyDeformGroupDamage | device:applyDeformGroupDamage(damage, type) | Internal hook for applying damage from JBeam deformGroup triggers. |
Usage Example
-- Get any powertrain device
local device = powertrain.getDevice("mainEngine")
-- Check if broken
if device.isBroken then
log("W", "powertrain", "Device is broken!")
end
-- Disable a device
device:disable()
-- Catastrophic failure
device:lockUp()See Also
- Combustion Engine — ICE implementation
- Electric Motor — Electric propulsion
- Differential — Power splitting
- Manual Gearbox — Manual transmission
Nitrous Oxide Injection
Chemical boost system that injects nitrous oxide (N₂O) into the engine intake for temporary power increases. Models tank capacity, arming, and injection state.
Range Box
Transfer case providing high and low range gear selections for 4WD vehicles. Multiplies the gear ratios for off-road crawling or highway driving.