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
State Entry (Flowgraph State Node)State Exit (Flowgraph State Node)State Node (Flowgraph Node)Transition (Flowgraph Node)Get Transition Variables (Flowgraph Node)

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 Extensionsflowgraphnodesstates

State Node (Flowgraph Node)

- **Node Name:** `State Node`

Overview

  • Node Name: State Node
  • Category: (default)
  • File: extensions/flowgraph/nodes/states/stateNode.lua
  • Hidden: Yes

Represents a state in a state-machine flowgraph. Each state node references a target graph that it encapsulates. Can contain sub-graphs (group states).

Pin Schema

Input Pins

PinTypeDescription
flowstateState flow pin

Output Pins

PinTypeDescription
successstateSuccess transition
failstateFailure transition

Custom state output pins can be added manually (allowCustomOutPins = true).

Behavior

  • init(mgr) - Enables custom output pins and pin saving.
  • setTargetGraph(graph) - Assigns the target graph this state node represents. Updates the node name and color (uses groupstate color if the target is itself a state graph).
  • representsGraph() - Returns the target graph (used by the editor to identify graph ownership).
  • doubleClicked() - Navigates the editor into the target graph.
  • getTransitionNames() - Returns sorted list of all output pin names (used by Transition nodes for their dropdown).
  • drawMiddle() - Displays graph name, marks group states, and highlights when active.

Serialization

  • _onSerialize(res) - Saves targetGraphId.
  • _onDeserialized(data) - Restores targetGraphId.
  • _postDeserialize() - Resolves targetGraphId to an actual graph reference using the manager's graph offset.
  • _onSerializeState() - Exports the full state (node + graph data) for saving as .state.flow.json.

Editor Integration

  • drawCustomProperties() - Combo box to select target graph from root-level graphs. Includes "Export State" button that saves to .state.flow.json.
  • onCustomNameChanged(name) - Renames the target graph when the node is renamed.

How It Works

  1. A state node wraps a sub-graph. When the state is active, the sub-graph runs.
  2. Output pins define possible transitions (e.g. success, fail, custom names).
  3. Transition nodes inside the sub-graph trigger these exits.
  4. The state manager tracks which state is active and handles transitions between state nodes.
-- State nodes are created via the special factory:
return _flowgraph_createStateNode(C)

-- The editor displays a combo for selecting which graph this state represents
-- Double-clicking navigates into the referenced graph

Key Dependencies

  • ui_flowgraph_editor - Node colors, icons, and tooltip utilities
  • ui_imgui - ImGui bindings for editor UI
  • extensions.editor_fileDialog - File save dialog for state export

Additional Methods

C:EndPin()

Node method.

C:setAutoStart(val)

Node method.

Parameters:

  • val

See Also

  • State Entry (Flowgraph State Node) - Related reference
  • State Exit (Flowgraph State Node) - Related reference
  • Transition (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

State Exit (Flowgraph State Node)

- **Node Name:** `State Exit`

Transition (Flowgraph Node)

- **Node Name:** `Transition`

On this page

OverviewPin SchemaInput PinsOutput PinsBehaviorSerializationEditor IntegrationHow It WorksKey DependenciesAdditional MethodsC:EndPin()C:setAutoStart(val)See Also