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

Vehicle Module

Flowgraph module that tracks all vehicles used by a flowgraph-spawned or foreign. Manages vehicle readiness, coupler attachments, bus systems, fuel storage, walk blacklist backup, and cleanup on flowg

Flowgraph module that tracks all vehicles used by a flowgraph-spawned or foreign. Manages vehicle readiness, coupler attachments, bus systems, fuel storage, walk blacklist backup, and cleanup on flowgraph stop.


Module Properties

PropertyValueDescription
moduleOrder-150Very early initialization (before most modules)
dependenciesgameplay_walk, core_vehicleBridgeRequired extensions
hooksonCouplerAttached, onCouplerDetached, onBusUpdate, onVehicleResettedVehicle event hooks

Class Methods

Lifecycle

MethodDescription
C:init()Initializes vehicles, sortedIds, couplings, unReadyIds; calls clear()
C:clear()Clears vehicles, sortedIds, couplings tables
C:executionStarted()Saves walk blacklist and trailer respawn state
C:executionStopped()Deletes non-kept vehicles; restores fuel for kept vehicles; restores walk blacklist and trailer respawn state

Vehicle Tracking

MethodDescription
C:addVehicle(veh, moreData)Registers a vehicle for tracking; sets canSave=false; initializes coupler data
C:addForeignVehicle(veh, moreData)Adds externally spawned vehicle with dontDelete=true
C:getVehicle(id)Returns tracked vehicle data or empty table
C:getSpawnedVehicles()Returns deep copy of sorted vehicle ID list
C:getVehicleIdByInternalName(name)Finds vehicle ID by exact internal name match
C:getVehiclesIdByInternalNameMatch(name)Finds vehicle IDs by partial internal name match
C:setKeepVehicle(id, keep)Marks vehicle to survive flowgraph stop; sets prefab to unpack before deletion

Readiness & Update

MethodDescription
C:onUpdate()Polls unready vehicles; calls readyUpVehicle when ready
C:readyUpVehicle(id)Enables map tracking, requests coupler offsets for all tag types via core_vehicleBridge

Coupler System

MethodDescription
C:addCouplerOffset(id, off, tag)Stores coupler offset positions by tag; sorts by tag priority
C:onCouplerAttached(objId1, objId2, nodeId, obj2nodeId)Records coupling between two vehicles
C:onCouplerDetached(objId1, objId2, nodeId, obj2nodeId)Removes coupling record
C:isCoupled(id)Returns truthy if vehicle has any coupling
C:isCoupledTo(id, other)Returns truthy if two specific vehicles are coupled

Fuel Management

MethodDescription
C:storeFuelAmount(id)Snapshots current energy storage for later restoration

Bus System

MethodDescription
C:isBus(id)Returns true if vehicle body style is "Bus"
C:requestBusData(id)Requests bus trigger tick data from vehicle
C:updateBusDisplayData(id, data)Sends route change data to bus controller
C:registerBusChangeNotification(id)Registers for kneel/door state change notifications
C:isBusKneel(id)Returns true if bus is kneeling
C:isBusDoorOpen(id)Returns true if bus door is open
C:requestBusStop(id, data)Sends stop request to bus controller

Hook Handlers

MethodDescription
C:onVehicleResetted(id)Forwards reset event to activity's onVehicleReset if available

Usage Example

local vehMod = mgr.modules.vehicle

-- Track a spawned vehicle
vehMod:addVehicle(spawnedVeh)

-- Track player's existing vehicle (won't delete on stop)
vehMod:addForeignVehicle(playerVeh)

-- Check coupler state
if vehMod:isCoupled(trailerId) then
  if vehMod:isCoupledTo(trailerId, truckId) then
    -- Truck-trailer connected
  end
end

-- Store and restore fuel
vehMod:storeFuelAmount(vehId)
-- fuel auto-restored on executionStopped for kept vehicles

-- Bus operations
if vehMod:isBus(vehId) then
  vehMod:registerBusChangeNotification(vehId)
  vehMod:updateBusDisplayData(vehId, routeData)
end

Internal Details

  • Coupler tag priority: tow_hitch(1), fifthwheel(2), gooseneck_hitch(3), fifthwheel_v2(4), pintle(5)
  • Vehicle readiness polled each frame in onUpdate() until veh:isReady() returns true
  • Walk blacklist saved/restored to prevent flowgraph from permanently modifying player walk restrictions
  • Trailer respawn state saved/restored via core_trailerRespawn
  • Energy storage restoration uses core_vehicleBridge.executeAction(veh, 'setEnergyStorageEnergy', ...)
  • Editor integration: calls editor.onRemoveSceneTreeObjects before deletion if editor loaded

See Also

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

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

Activity Attempt Node

Creates a new mission attempt data object. Supports custom data pins that get included in the attempt's `tData` payload. Category: `once_instant`.

On this page

Module PropertiesClass MethodsLifecycleVehicle TrackingReadiness & UpdateCoupler SystemFuel ManagementBus SystemHook HandlersUsage ExampleInternal DetailsSee Also