RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Flowgraph Action ModuleFlowgraph AI Recording ModuleFlowgraph Button ModuleFlowgraph Camera ModuleFlowgraph Drift ModuleFlowgraph File ModuleFlowgraph Foreach ModuleFlowgraph Level ModuleFlowgraph Mission ModuleMission Replay ModulePrefab ModuleThread ModuleTimer ModuleTraffic ModuleUI ModuleVehicle Module

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphmodules

Thread Module

Flowgraph module for inter-flowgraph messaging and child project management. Enables flowgraph managers to send/receive messages and spawn child flowgraph projects that communicate back via the thread

Flowgraph module for inter-flowgraph messaging and child project management. Enables flowgraph managers to send/receive messages and spawn child flowgraph projects that communicate back via the thread system.


Module Properties

PropertyValueDescription
moduleOrder1000Late initialization order
hooksonFlowgraphManagerPreUpdateProcesses queued messages each frame

Class Methods

Lifecycle

MethodDescription
C:init()Calls clear()
C:clear()Resets children, messages, parentId
C:executionStarted()Empty (placeholder)
C:executionStopped()Stops all child flowgraphs, removes them, then clears state

Messaging

MethodDescription
C:sendMessage(targetId, message, sourceNode)Sends a message to another flowgraph manager by ID (-1 targets parent); logs the event
C:receiveMessage(message, sourceId)Queues an incoming message for processing next frame
C:onFlowgraphManagerPreUpdate()Processes all queued messages: broadcasts via message.hook or onThreadMessageProcess

Child Project Management

MethodDescription
C:startProjectFromFilepath(file, sourceNode)Loads and starts a child flowgraph from file; sets parent ID for return messaging; returns child manager ID

Usage Example

local threadMod = mgr.modules.thread

-- Send a message to another flowgraph manager
threadMod:sendMessage(targetMgrId, {
  name = "missionComplete",
  hook = "onMissionCompleted",  -- optional: broadcast as this hook
  data = { score = 100 }
}, sourceNode)

-- Spawn a child flowgraph project
local childId = threadMod:startProjectFromFilepath(
  "/gameplay/missions/race/race_flow.flow.json",
  sourceNode
)

-- Send message to parent (-1 = parent)
threadMod:sendMessage(-1, { name = "childDone" }, sourceNode)

-- Messages without a .hook field are broadcast as:
-- mgr:broadcastCall("onThreadMessageProcess", message)

Internal Details

  • Messages are queued in self.messages and processed in onFlowgraphManagerPreUpdate
  • If message.hook is set, broadcast uses that hook name with message.data
  • Child projects tracked in self.children as {fgId, originalPath}
  • Child's parentId set to spawner's manager ID for return messaging
  • On execution stop, all children are stopped and scheduled for removal via core_flowgraphManager.removeNextFrame

Additional Exports

afterTrigger()


See Also

  • Flowgraph Action Module - Related reference
  • Flowgraph AI Recording Module - Related reference
  • Flowgraph Button Module - Related reference
  • FlowGraph Guide - Guide

Prefab Module

Flowgraph module that manages prefab lifecycle-spawning, tracking, collision/navgraph reloading, vehicle extraction, and cleanup. Ensures all spawned prefabs are properly deleted when the flowgraph st

Timer Module

Flowgraph module providing a managed timer system with pause/resume, multiple time modes (real/sim/raw), and variable-backed storage. Timers are identified by auto-incrementing IDs and support elapsed

On this page

Module PropertiesClass MethodsLifecycleMessagingChild Project ManagementUsage ExampleInternal DetailsAdditional ExportsafterTrigger()See Also