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
And (Flowgraph Node)Boolean Expression (Flowgraph Node)Branch (Flowgraph Node)Bundle (Flowgraph Node)Chainflow Branch (Flowgraph Node)Compare (Flowgraph Node)Edge Detector (Flowgraph Node)Flow Switch (Flowgraph Node)Frame Delay (Flowgraph Node)Once (Flowgraph Node)Flow Interval / Rate Limit (Flowgraph Node)Select (Flowgraph Node)Sequencer (Flowgraph Node)Switch Case (Flowgraph Node)Timed Trigger (Flowgraph Node)Wait (Flowgraph Node)XOR (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 Extensionsflowgraphnodeslogic

Switch Case (Flowgraph Node)

- **Node Name:** `Switch Case`

Overview

  • Node Name: Switch Case
  • Category: logic
  • File: extensions/flowgraph/nodes/logic/switchcase.lua

Compares an input value against multiple case values and routes flow to the matching output. Equivalent to a switch/case statement.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node
valueanyThe value to match against
value_1anyCase value 1

Additional value_N input pins created via Count property.

Output Pins

PinTypeDescription
flowflowOutflow (always active)
noneflowFlow when no case matches
match_1flowFlow when value_1 matches

Additional match_N output pins created via Count property.

Behavior

  • init() - Sets count to 1.
  • work() - Iterates through all case values. If value_N == value, sets match_N to true. If no match, sets none to true. Flow always passes through.
  • updatePins(old, new) - Dynamically adds/removes value_N/match_N pin pairs.
  • drawCustomProperties() - UI for adjusting the case count.

How It Works

The node performs equality comparison (==) between the input value and each value_N case. All matching cases fire simultaneously (not just the first). If none match, the none output fires. The main flow output always passes through regardless of matching.

Example Usage

-- Route based on vehicle type:
-- value = vehicleType (string)
-- value_1 = "car", match_1 → handle car logic
-- value_2 = "truck", match_2 → handle truck logic
-- value_3 = "bus", match_3 → handle bus logic
-- none → unknown vehicle type

-- Equivalent Lua:
if value == "car" then      -- match_1
elseif value == "truck" then -- match_2
elseif value == "bus" then   -- match_3
else                         -- none
end

Additional Methods

C:_executionStarted()

Called when graph execution starts. Used for initialization/reset.

C:_onDeserialized(res)

Called after the node is deserialized (loaded from file). Restores runtime state from saved data.

Parameters:

  • res

C:_onSerialize(res)

Called when the node is serialized (saved to file). Returns data to persist.

Parameters:

  • res

C:drawMiddle(builder, style)

Custom ImGui drawing in the middle section of the node in the editor.

Parameters:

  • builder
  • style

See Also

  • And (Flowgraph Node) - Related reference
  • Boolean Expression (Flowgraph Node) - Related reference
  • Branch (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Sequencer (Flowgraph Node)

- **Node Name:** `Sequencer`

Timed Trigger (Flowgraph Node)

- **Node Name:** `Timed Trigger`

On this page

OverviewPin SchemaInput PinsOutput PinsBehaviorHow It WorksExample UsageAdditional MethodsC:_executionStarted()C:_onDeserialized(res)C:_onSerialize(res)C:drawMiddle(builder, style)See Also