RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Drag Race DebugDrag Tree DisplayDrag Race APIDrag Racing ManagerDrag Strip Save SystemDrag Race TimingDrag Race Phases

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 Extensionsgameplaydrag

Drag Racing Manager

Reference for `gameplay_drag_general`, which is the central state manager for the entire drag racing subsystem. Owns `dragData`, manages extension loading/unloading, racer setup, race lifecycle, times

Reference for gameplay_drag_general, which is the central state manager for the entire drag racing subsystem. Owns dragData, manages extension loading/unloading, racer setup, race lifecycle, timeslips, and freeroam POI integration.


Dependencies

gameplay_drag_saveSystem, gameplay_drag_dragBridge


Exports

Extension Lifecycle

| Function | Signature | Description | |------ | M.dependencies | table | {'gameplay_drag_saveSystem', 'gameplay_drag_dragBridge'} | | M.dependencies | table | {'gameplay_drag_saveSystem', 'gameplay_drag_dragBridge'} | | M.dependencies | table | {'gameplay_drag_saveSystem', 'gameplay_drag_dragBridge'} |----| | M.onExtensionLoaded | onExtensionLoaded handler |----------- | M.setExtension | (ext) | nil | setExtension | | M.getExtension | () | any | getExtension | | M.getDebugMenu | () | any | getDebugMenu | | M.setDebugMenu | (enabled) | nil | setDebugMenu | | M.drawDebugMenu | () | nil | drawDebugMenu | | M.createTimeslipPanelData | () | any | createTimeslipPanelData | | M.setCareerRewrads | () | nil | setCareerRewrads || | M.onCareerActive | onCareerActive handler |-------------| | onExtensionLoaded | () | Clears all state | | onVehicleResetted | (vehicleId) | Clears if player reset during freeroam race | | onVehicleSwitched | (oldId, newId) | Clears if switching vehicles during freeroam race | | onVehicleDestroyed | (vehicleId) | Clears if vehicle destroyed during freeroam race | | onAnyMissionChanged | (status, mission) | Clears on mission stop (non-activity context) |

Data Management

FunctionSignatureDescription
loadDragStripData(filepath) → tableLoad strip from JSON via save system
setDragRaceData(data)Set dragData and ensure all extensions loaded
getData() → table|nilGet current drag data
getRacerData(vehicleId) → tableGet a specific racer
getTimers(vehicleId) → tableGet racer timers
getDragIsStarted() → boolRace started flag
getGameplayContext() → string"freeroam" / "activity"
clearDragData()Full clear: unload extensions, reset UI

Racer Management

FunctionSignatureDescription
setupRacer(vehicleId, lane)Create racer with timers, phases, wheel offsets
setPlayableVehicle(vehicleId)Mark racer as player-controlled
setRacerDial(vehicleId, dialValue) → boolSet individual dial
setRacersDial(dials) → boolBatch set [{racerId, value}]
clearRacers()Empty the racers table

Race Control

FunctionSignatureDescription
startDragRaceActivity(lane) → boolVerify extensions, set up freeroam, start activity
resetDragRace()Reset phases/flags without clearing data

Timeslip

FunctionSignatureDescription
createTimeslipData() → tableFull timeslip with strip info, env, racer details
sendTimeslipDataToUi()Save + push timeslip to UI
screenshotTimeslip()Save screenshot to screenshots/timeslips/
clearTimeslip()Clear timeslip UI

Save System Passthrough

FunctionSignatureDescription
saveDialTimes(timeslip?)Save dial times via save system
saveDialFile(dir)Save dial file to directory
getCurrentSavePath() → stringCareer save path
onSaveCurrentSaveSlot(currentSavePath)Hook to persist dial data

Freeroam POI

FunctionSignatureDescription
getDragDataForLevel(levelId) → tableScan level's dragstrips/ for settings files
onGetRawPoiListForLevel(levelId, elements)Inject invisible trigger POIs at stage positions

Racer Data Structure

racer = {
  vehId = vehicleId,
  lane = 1,
  isPlayable = true,
  isDesqualified = false,
  desqualifiedReason = "None",
  isFinished = false,
  treeStarted = false,
  timersStarted = false,
  currentPhase = 1,
  damage = 0,
  phases = {{name="stage", started=false, completed=false, dependency=true}, ...},
  timers = {
    dial         = {type="dialTimer", value=10},
    reactionTime = {type="distanceTimer", value=0, distance=0.178},
    time_60      = {type="distanceTimer", value=0, distance=18.288},
    time_330     = {type="distanceTimer", value=0, distance=100.584},
    time_1_8     = {type="distanceTimer", value=0, distance=201.168},
    time_1000    = {type="distanceTimer", value=0, distance=304.8},
    time_1_4     = {type="distanceTimer", value=0, distance=402.336},
    velAt_1_8    = {type="velocity", value=0, distance=201.168},
    velAt_1_4    = {type="velocity", value=0, distance=402.336},
    time_0_60    = {type="timeToVelocity", value=0, velocity=26.8224},
    brakingG     = {type="brakingG", value=0, deltaTime=1},
  },
  -- Computed per frame:
  vehPos, vehSpeed, vehDirectionVector, wheelsCenter, allWheelsOffsets, ...
}

How It Works

-- Freeroam trigger flow:
-- 1. Player drives into stage position trigger (6m radius)
-- 2. onGetRawPoiListForLevel creates invisible POI
-- 3. POI.onInside → setDragRaceData(deepcopy(data)) → startDragRaceActivity(lane)
-- 4. startDragRaceActivity ensures extensions, sets up racer, starts activity

-- Mission flow:
-- 1. dragBridge.loadDragDataForMission(filepath)
-- 2. dragBridge.setVehicles(vehicleIds)
-- 3. dragBridge.startDragRaceActivity(lane)

Key Behaviors

  • ensureAllExtensionsLoaded() dynamically loads utils, times, display, and the drag type extension based on dragData.dragType
  • Wheel offsets are calculated from actual node positions, grouped by "frontness" (distance along vehicle forward axis)
  • Career rewards: 5 BMRA per completed drag race (non-activity context)
  • Freeroam context auto-clears on vehicle reset, switch, or destruction
  • The _ prefixed internal accessors (_getDragData, _setupRacer, etc.) are used by dragBridge

Additional Exports

FunctionSignatureDescription
setCareerRewrads()Sets career reward amounts (sic - typo in source)
createTimeslipPanelData() → tableBuilds panel-format timeslip for UI
drawDebugMenu()Renders ImGui debug menu
setDebugMenu(enabled)Enables/disables debug menu
getDebugMenu() → boolReturns debug menu state
getExtension() → tableReturns the current drag type extension
setExtension(ext)Sets the drag type extension reference

Hooks / Lifecycle

FunctionDescription
onExtensionLoadedClears all drag state on load
onVehicleResettedClears if player reset during freeroam race
onVehicleSwitchedClears if switching vehicles during freeroam race
onVehicleDestroyedClears if vehicle destroyed during freeroam race
onAnyMissionChangedClears on mission stop (non-activity context)
onSaveCurrentSaveSlotPersists dial data to career save
onCareerActiveLoads career-specific save data

Internal Accessors (underscore-prefixed, used by dragBridge)

FunctionSignatureDescription
_getDragData()Returns internal dragData table
_setDragData(data)Sets internal dragData table
_getGameplayContext()Returns current gameplay context string
_setGameplayContext(context)Sets gameplay context ("freeroam"/"activity")
_getDragExtension()Returns current drag type extension ref
_setDragExtension(ext)Sets current drag type extension ref
_setupRacer(vehicleId, lane)Direct alias to setupRacer

Module Variables

VariableTypeDescription
M.dependenciestable{'gameplay_drag_saveSystem', 'gameplay_drag_dragBridge'}
M._clear()-
M._getDragData()-
M._getDragExtension()-
M._getGameplayContext()-
M._loadDragStripData(filepath)-
M._loadPrefabs(data)-
M._setDragData(data)-
M._setDragExtension(ext)-
M._setGameplayContext(context)-
M._setupRacer(vehicleId, lane)-
M.clearDragData()-
M.clearRacers()-
M.clearTimeslip()-
M.createTimeslipData()-
M.getCurrentSavePath()-
M.getData()-
M.getDragDataForLevel(levelIdentifier)-
M.getDragIsStarted()-
M.getGameplayContext()-
M.getRacerData(vehicleId)-
M.getTimers(vehicleId)-
M.loadDragStripData(filepath)-
M.onAnyMissionChanged(status, mission)-
M.onGetRawPoiListForLevel(levelIdentifier, elements)-
M.onSaveCurrentSaveSlot(currentSavePath)-
M.onVehicleDestroyed(vehicleId)-
M.onVehicleResetted(vehicleId)-
M.onVehicleSwitched(oldId, newId)-
M.resetDragRace()-
M.saveDialFile(dir)-
M.saveDialTimes(timeslip)-
M.screenshotTimeslip()-
M.sendTimeslipDataToUi()-
M.setDragRaceData(data)-
M.setPlayableVehicle(vehicleId)-
M.setRacerDial(vehicleId, dialValue)-
M.setRacersDial(dials)-
M.setupRacer(vehicleId, lane)-
M.startDragRaceActivity(lane)-

See Also

  • drag/debug - Drag Race Debug Menu - Related reference
  • drag/display - Christmas Tree & Display Signs - Related reference
  • drag/dragBridge - Flowgraph / External API Bridge - Related reference
  • Gameplay Systems Guide - Guide

Drag Race API

Reference for `gameplay_drag_dragBridge`, which provides a stable public API over the internal drag race subsystem. Used by flowgraph nodes, missions, and UI screens.

Drag Strip Save System

Reference for `gameplay_drag_saveSystem`, which handles loading drag strip data from JSON, converting legacy formats, managing dial times / race history, and spawning prefabs.

On this page

DependenciesExportsExtension LifecycleData ManagementRacer ManagementRace ControlTimeslipSave System PassthroughFreeroam POIRacer Data StructureHow It WorksKey BehaviorsAdditional ExportsHooks / LifecycleInternal Accessors (underscore-prefixed, used by dragBridge)Module VariablesSee Also