flowgraph_nodes_mission_selectGarage2GarageZones¶
File: lua/ge/extensions/flowgraph/nodes/mission/selectGarage2GarageZones.lua · VM: Game Engine (GE) · 265 lines · BeamNG.drive 0.40.5 (buildbot 302427 on GitLab)
Access: require("extensions/flowgraph/nodes/mission/selectGarage2GarageZones") (file under extensions/ but not a regular extension)
Flowgraph node 'Select Garage Sites' (once_instant category, author BeamNG). Picks a start spot in the mission's initial zones and an end spot in the destination zones (mission.initialZones and destinationZones, generated by mission:generateZoneLists if needed), from sitesData.parkingSpots. Avoids already used spots, enforces a distance between minDist and maxDist (otherwise takes the best candidate). Outputs: impulse 'loaded', startSpot, endSpot, startLocation, endLocation (zone names).
Notes¶
- The best candidate is the one whose (distance - maxDist) is the smallest, which can be a negative value (too close).
- Spots are compared by name and marked as used in usedStartSpots / usedEndSpots.
Class C¶
Flowgraph node class (created by _flowgraph_createNode(C)). The methods are called by the flowgraph manager or the editor.
| Method | Description | Line |
|---|---|---|
C:_executionStarted() |
Resets the selection and the outputs to zero. | 41 |
C:findEndSpotForStartingSpot(startSpot, possibleEndSpots) |
Shuffles the possible end spots and returns the first one whose distance to the start spot is within [minDist, maxDist]; otherwise the one closest to maxDist from below (best candidate). | 95 |
C:init() |
Initializes the state, the used spots and the outputs. | 28 |
C:resetData() |
Resets the selection, state=1 and the outputs to zero. | 53 |
C:work() |
state 1: computes the possible spots, empties the usage lists when exhausted, picks start and end, sorts the zones by prio, writes the outputs and loaded=true, goes to state 2. state 2: loaded=false. | 138 |
C:workOnce() |
Calls resetData. | 65 |
tim19Atlas (Tim0219800) — derived from BeamNG GmbH Lua code (bCDDL 1.1, see LICENSE). Source: lua/ge/extensions/flowgraph/nodes/mission/selectGarage2GarageZones.lua.