API ReferenceGE Extensionsflowgraphnodesvehicle
Get Powertrain Data
- **Node Name:** `Get Powertrain Data`
Overview
- Node Name:
Get Powertrain Data - Category:
once_f_duration - File:
extensions/flowgraph/nodes/vehicle/getPowertrainData.lua
Gets arbitrary powertrain device data from a vehicle. Specify a device name and property to query any powertrain value (engine RPM, torque, gear ratio, etc.).
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle. Defaults to player vehicle |
device | string | Name of the powertrain device (e.g. mainEngine, gearbox) |
property | string | Property to read from the device (e.g. outputTorque, gearRatio) |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | any | The returned powertrain value |
Internals
Key Methods
| Method | Description |
|---|---|
init() / _executionStarted() | Reset via onNodeReset() |
onNodeReset() | Clears receivedInfo and sets duration to inactive |
workOnce() | Sends an async request via core_vehicleBridge.requestValue(veh, callback, 'powertrainDevice', device, property) |
work() | Checks for receivedInfo; when available, outputs the value and sets duration to finished |
How It Works
workOnce()resolves the vehicle and sends an async request to the specified powertrain device for the given property.- The callback captures
val.resultintoself.receivedInfo. - Each frame,
work()checks if the async response has arrived. - When data is available, it outputs the value, clears
receivedInfo, and sets duration tofinished.
Usage Example
-- In a flowgraph:
-- [Get Powertrain Data (device="mainEngine", property="outputTorque")]
-- → value → [Display Torque]
-- Programmatic equivalent:
local veh = getPlayerVehicle(0)
core_vehicleBridge.requestValue(veh, function(val)
print("Engine torque:", val.result)
end, 'powertrainDevice', 'mainEngine', 'outputTorque')Key Dependencies
core_vehicleBridge.requestValue()- sends async requests to vehicle powertrain devices
See Also
- Align for Coupling (Flowgraph Node) - Related reference
- Apply Velocity to Vehicle (Flowgraph Node) - Related reference
- Boost Vehicle (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide