API ReferenceGE Extensionsflowgraphnodesvehicle
Vehicle States
- **Node Name:** `Vehicle States`
Overview
- Node Name:
Vehicle States - Category:
repeat_instant - File:
extensions/flowgraph/nodes/vehicle/states.lua
Reads the current state of a vehicle (horn active, lightbar active) from the map.objects data and outputs flow/bool signals accordingly.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle to query states for. |
Output Pins
| Pin | Type | Description |
|---|---|---|
horn | flow | Active when the vehicle's horn is on. |
lightbar | flow | Active when the vehicle's lightbar is on. |
hornb | bool | Boolean: is the horn active? (hidden) |
lightbarb | bool | Boolean: is the lightbar active? (hidden) |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Reads map.objects[vehId].states and sets horn/lightbar outputs. |
How It Works
- Each frame, looks up the vehicle in
map.objectsby ID. - Reads the
statestable from the map object data. - Sets flow and boolean output pins for
hornandlightbarbased on truthiness of the state values. - If the vehicle is not found in the map, outputs default to
false.
Usage Example
-- Flowgraph:
-- [Vehicle ID] → vehId → [Vehicle States]
-- ↓ horn
-- [Play Horn Sound Effect]
-- ↓ lightbar
-- [Activate Mission Checkpoint]
-- Checking vehicle states in regular GE Lua:
local states = map.objects[vehId].states
if states.horn then
-- horn is active
endKey Dependencies
map.objects- global map object data containing vehicle states
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