API ReferenceGE Extensionsflowgraphnodesvehiclespecial
Vehicle Action
- **Node Name:** `Vehicle Action`
Overview
- Node Name:
Vehicle Action - Category:
repeat_p_duration - File:
extensions/flowgraph/nodes/vehicle/special/vehicleAction.lua
Calls a vehicle action defined in input_actions.json - simulating key-presses (onDown/onChange/onUp) on a vehicle's action map from the flowgraph.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle that receives the action. |
val | number | VALUE parameter substituted into the action command. |
inputFilter | number | FILTERTYPE parameter (hidden, default 0). |
angle | number | ANGLE parameter (hidden, default 0). |
down | flow | Simulates the "onDown" key press. |
change | flow | Simulates the "onChange" event. |
up | flow | Simulates the "onUp" key release. |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Initialises model/action state; defaults to "No Action". |
loadActions(key, file) | Reads input_actions.json for a vehicle model or the global vehicle actions file, caching results. |
drawCustomProperties() | Renders vehicle selector and action combo box in the editor UI. |
formatCommand(cmd) | Replaces VALUE, FILTERTYPE, ANGLE placeholders in action command strings with pin values. |
work() | Finds the vehicle and queues the appropriate Lua command(s) based on which flow pins are active. |
_onSerialize(res) | Saves model, vehType, modelName, and action data. |
_onDeserialized(nodeData) | Restores serialised state. |
Static Cache
vehicleActionMaps- module-level table caching loaded action maps keyed by model name or'allVehicles'.
How It Works
- In the editor, the user selects a vehicle model and picks an action from its
input_actions.json. - The global vehicle actions from
lua/ge/extensions/core/input/actions/vehicle.jsonare always available. - At runtime, when
down,change, orupflow pins fire, the node formats the corresponding command string (replacingVALUE,FILTERTYPE,ANGLE) and sends it to the vehicle viaveh:queueLuaCommand().
Usage Example
-- Flowgraph setup:
-- 1. Place a "Vehicle Action" node
-- 2. Select model (e.g. "pickup") and load its actions
-- 3. Choose an action (e.g. "Toggle Headlights")
-- 4. Connect a trigger to the "down" pin
-- 5. Wire vehId from a vehicle provider
-- The node internally runs something like:
veh:queueLuaCommand("electrics.toggle_lights_state()")Key Dependencies
ui_flowgraph_editor.vehicleSelector- editor helper for model/config selectionjsonReadFile()- readsinput_actions.jsonfilesveh:queueLuaCommand()- sends Lua to the vehicle VM
See Also
- Get Custom Vehicle Value (Flowgraph Node) - Related reference
- Custom Vehicle Lua (Flowgraph Node) - Related reference
- Custom vlua - Deprecated (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide