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

Traffic Module

Flowgraph module wrapping `gameplay_traffic` and `gameplay_parking` APIs for flowgraph-managed traffic and parked car activation/deactivation. Automatically cleans up traffic and parking state when th

Flowgraph module wrapping gameplay_traffic and gameplay_parking APIs for flowgraph-managed traffic and parked car activation/deactivation. Automatically cleans up traffic and parking state when the flowgraph stops.


Module Properties

PropertyValueDescription
moduleOrder0Early initialization order

Class Methods

Lifecycle

MethodDescription
C:init()Sets trafficActive, parkedCarsActive, keepTrafficState to false
C:executionStopped()Unless keepTrafficState is set: resets traffic/police/parking vars, deactivates both; always resets keepTrafficState to false

Traffic Control

MethodDescription
C:insertTraffic(id)Inserts a vehicle into traffic by ID
C:removeTraffic(id)Removes a vehicle from traffic by ID
C:activateTraffic(vehList)Activates traffic with optional vehicle list
C:deactivateTraffic()Deactivates traffic if currently active
C:updateTrafficState()Refreshes trafficActive flag from gameplay_traffic.getTrafficData()

Parked Cars Control

MethodDescription
C:activateParkedCars(vehList)Processes/activates parked cars with vehicle list
C:deactivateParkedCars()Deactivates parked cars if currently active
C:updateParkedCarsState()Refreshes parkedCarsActive flag from gameplay_parking.getParkedCarsData()

Usage Example

local trafficMod = mgr.modules.traffic

-- Activate traffic (all vehicles)
trafficMod:activateTraffic()

-- Insert a specific vehicle into traffic
trafficMod:insertTraffic(vehicleId)

-- Activate parked cars
trafficMod:activateParkedCars(parkedVehList)

-- Keep traffic alive after flowgraph stops
trafficMod.keepTrafficState = true

-- On executionStopped (automatic):
-- Resets gameplay_traffic vars, gameplay_police pursuit vars,
-- gameplay_parking vars, then deactivates both systems

Internal Details

  • State flags (trafficActive, parkedCarsActive) updated only when flowgraph modifies traffic
  • keepTrafficState prevents cleanup on stop (auto-resets to false)
  • Cleanup order: reset vars → deactivate traffic → deactivate parking
  • Wraps: gameplay_traffic.activate/deactivate/insertTraffic/removeTraffic/setTrafficVars
  • Wraps: gameplay_parking.processVehicles/setParkingVars
  • Also resets gameplay_police.setPursuitVars() on stop

See Also

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

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

UI Module

Flowgraph module that builds mission start/end screen UIs. Provides a builder pattern for composing screen layouts with elements (text panels, objectives, ratings, drift stats, lap times, crash analys

On this page

Module PropertiesClass MethodsLifecycleTraffic ControlParked Cars ControlUsage ExampleInternal DetailsSee Also