Flowgraph Level Module
Manages level-loading coordination for flowgraph projects. Handles deferred function execution during level loads, prefab registration, and collision reload scheduling.
Manages level-loading coordination for flowgraph projects. Handles deferred function execution during level loads, prefab registration, and collision reload scheduling.
No public module exports - created via _flowgraph_createModule(C).
Purpose
During level loading, certain operations must be deferred until the load completes. This module queues functions and manages collision reloads that need to happen either during or after level loading.
Key Methods
| Method | Signature | Description |
|---|---|---|
init | () | Initializes function queues, prefab list, and reload flags. |
clear | () | Clears all queues and resets flags. |
beginLoadingLevel | () | Placeholder for level load start (currently no-op). |
finishedLevelLoading | () | If collision reload was requested during loading, executes be:reloadCollision(). Then runs all queued functions. |
afterTrigger | () | If collision reload was requested after loading, executes be:reloadCollision(). |
delayOrInstantFunction | (fun) | If a level is currently loading (core_gamestate.loading()), queues the function. Otherwise executes immediately. |
prefabLoaded | (id) | Registers a loaded prefab ID and schedules collision reload (during or after loading depending on current state). |
executionStopped | () | Calls clear(). |
Collision Reload Strategy
prefabLoaded(id)
│
├── core_gamestate.loading() == true
│ └── reloadCollisionOnLevelLoading = true
│ (be:reloadCollision() called in finishedLevelLoading)
│
└── core_gamestate.loading() == false
└── reloadCollisionOnAfterTrigger = true
(be:reloadCollision() called in afterTrigger)Properties
| Property | Default | Description |
|---|---|---|
moduleOrder | 100 | Mid-high priority. |
funs | {} | Queue of deferred functions to run after level loading. |
uniqueFuns | {} | De-duplicated function queue. |
prefabs | {} | List of loaded prefab IDs. |
reloadCollisionOnLevelLoading | false | Flag to reload collision when level finishes loading. |
reloadCollisionOnAfterTrigger | false | Flag to reload collision on next afterTrigger. |
Usage from Nodes
-- Defer a function until level is ready:
local levelModule = self.mgr:getModule("level")
levelModule:delayOrInstantFunction(function()
-- setup spawned objects, etc.
scenetree.findObject("myPrefab"):setHidden(false)
end)
-- Register a loaded prefab (triggers collision reload):
levelModule:prefabLoaded(prefabId)See Also
- Flowgraph Action Module - Related reference
- Flowgraph AI Recording Module - Related reference
- Flowgraph Button Module - Related reference
- FlowGraph Guide - Guide
Flowgraph Foreach Module
Minimal module that stores key-value iteration state for flowgraph projects spawned as foreach children. When a parent flowgraph iterates over a collection, each child manager gets a foreach module co
Flowgraph Mission Module
Manages mission-specific vehicle handling, traffic control, and mission lifecycle events for flowgraph projects. Coordinates between the flowgraph execution and the mission system.