API ReferenceGE Extensionsflowgraphnodesmission
Select Garage Spots (Flowgraph Node)
- **Node Name:** `Select Garage Spots`
Overview
- Node Name:
Select Garage Spots - Category:
once_p_duration - File:
extensions/flowgraph/nodes/mission/selectGarageSpots.lua - Icon: Scene icon
- Color: Scene color
- Author: BeamNG
Selects randomized start and end parking spots for a Garage-to-Garage mission. Supports zone filtering, distance constraints, and duplicate prevention.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Trigger this node |
reset | flow (impulse) | Reset the node state |
sitesData | table | Sites data with parkingSpots.byName |
minDist | number | Minimum distance between start and end spots |
maxDist | number | Maximum distance between start and end spots |
zone | string | Zone name filter for starting spots (used when isLocal is true) |
isLocal | bool | If true, only starting spots in the specified zone are considered |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Active once spots are found |
loaded | flow (impulse) | Fires once after spots are selected |
startSpot | string | Selected start parking spot name |
endSpot | string | Selected end parking spot name |
startLocation | string | Zone name of the start location |
endLocation | string | Zone name of the end location |
Internals
self.usedStartingSpotNames- array of previously used start spot names; resets when all spots exhausted.self.spots/self.names- cached parking spot data fromsitesData.self.state-1= selecting,2= done (flow continues, impulse cleared).
findEndSpotForStartingSpot(startSpot)
Shuffles all parking spots, iterates to find one within [minDist, maxDist] direct distance from the start. Falls back to the closest candidate if none fits exactly.
How It Works
- When flow is active and state is
1:- Loads parking spots from
sitesData. - If
isLocal, filters starting candidates to only those whose highest-priority zone matcheszone. - Removes previously used starting spots; resets the used list when exhausted.
- Shuffles available starts, picks the first.
- Finds a suitable end spot via
findEndSpotForStartingSpot. - Sorts zones by priority and outputs spot + location names.
- Loads parking spots from
- State
2: keeps flow active, clears theloadedimpulse.
Lua Code Example
-- Garage-to-Garage with local zone filtering:
-- selectGarageSpots (isLocal=true, zone="Downtown", minDist=200, maxDist=2000)
-- .startSpot → navigation origin
-- .endSpot → navigation destinationKey Dependencies
sitesData.parkingSpots.byName- parking spot databasetableKeys,tableValuesAsLookupDict- BeamNG table utilities
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:init()
Initializes the node, setting up pins and default properties.
C:resetData()
Node method.
C:work()
Main work function called each frame/tick when the node is active.
C:workOnce()
Called once when the node is triggered (flow-once execution).
See Also
- ARunForLife (Flowgraph Node) - Related reference
- Update Display Drag Race (Flowgraph Node) - Related reference
- Clear Lights Drag Race (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide