API ReferenceGE Extensionsflowgraphnodesvehicleai
AI Stop
- **Node Name:** `AI Stop`
Overview
- Node Name:
AI Stop - Category:
once_p_duration - File:
extensions/flowgraph/nodes/vehicle/ai/stop.lua
Commands the AI to stop a vehicle. Provides a stopped flow output that fires once the vehicle's velocity drops below a threshold.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
aiVehId | number | - | Vehicle ID to stop. Uses player vehicle if empty. |
checkVelocity | number | 0.01 | Velocity threshold to consider the vehicle stopped (hidden, hardcoded). |
Output Pins
| Pin | Type | Description |
|---|---|---|
stopped | flow | Fires once the vehicle velocity is below checkVelocity. |
Internals
Key Methods
| Method | Description |
|---|---|
workOnce() | Sends ai.setState({mode = "stop"}) to the vehicle. |
work() | Checks map.objects[vehId].vel:length() against threshold; sets complete when below. |
onNodeReset() | Resets complete flag. |
_executionStarted() | Calls onNodeReset(). |
How It Works
workOnce()fires once and sendsai.setState({mode = "stop"})- the AI begins braking.- Each frame,
work()reads the vehicle velocity frommap.objects. - When velocity magnitude drops below
checkVelocity(default 0.01 m/s), setscomplete = true. - On subsequent frames, outputs
stopped = true.
Usage Example
-- Flowgraph:
-- [Some Event] → [AI Stop (aiVehId=myVeh)] → stopped → [Vehicle Is Parked]
-- Equivalent vehicle command:
ai.setState({mode = "stop"})
-- Then check: map.objects[vehId].vel:length() < 0.01Key Dependencies
ai.setState({mode = "stop"})- vehicle-side AI stop commandmap.objects[id].vel- velocity data from the map module
See Also
- AI Parameters (Flowgraph Node) - Related reference
- AI Arrive (Flowgraph Node) - Related reference
- AI Chase (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide