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.
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.
Overview
Thin facade that delegates to gameplay_drag_general, gameplay_drag_saveSystem, and gameplay_drag_utils. Provides load/start/stop/query functions without exposing internal state management. Also includes opponent generation and vehicle permission checking utilities for career / mission use.
Exports
| Function | Signature | Description |
|---|---|---|
loadDragStrip | (dragStripId) → table|nil | Load strip data (new modular → legacy fallback) |
configureDragStrip | (dragStrip) → bool | Compatibility stub - returns true if non-nil |
startDragRace | (vehicleId, lane) → bool | Start a race for a vehicle in a lane |
stopDragRace | () → true | Clears all drag data |
resetDragRace | () → bool | Resets current race without clearing data |
getDragRaceData | () → table|nil | Active playable racer snapshot |
getDragRaceRuntimeData | () → table|nil | Extended runtime data (pos, speed, damage) |
getDragStripInfo | (dragStripId?) → table|nil | Strip metadata (name, lanes, phases, prefabs) |
isDragRaceActive | () → bool | Whether a race is currently started |
getActiveRacerId | () → number|nil | Vehicle ID of the playable racer |
getAllDragStrips | () → table | All strip data from save system |
getPlayerDragTimes | (vehicleId) → table | Saved times for a vehicle |
savePlayerDragTimes | (vehicleId, times) | Persist times |
generateOpponentsGroup | (vehId, dial, rules, amount, offset) → table | Pick random opponents by quarter-mile time |
setupRacer | (vehicleId, lane) | Direct racer setup passthrough |
setVehicles | (vehicleIds) | Batch-set racers with lane, playable, dial |
getTimers | (vehicleId) → table | Timer data for a racer |
getData | () → table | Raw drag data |
getRacerData | (vehicleId) → table | Racer entry |
loadDragDataForMission | (filepath) | Full mission load: clear → load → prefabs → extensions |
startDragRaceActivity | (lane) → bool | Start via general |
clearRacers | () | Remove all racers |
setRacerDial | (vehicleId, dialValue) | Set single racer dial |
setRacersDial | (dials) | Batch set dials |
unloadRace | () | Full clear |
getDialTimes | () → table | Saved dial times |
generateHashFromFile | (vehicleId?) → string | Config hash for dial lookup |
getDragIsStarted | () → bool | Race started flag |
getWinnersData | () → table | Winner list from utils |
createTimeslipData | () → table | Timeslip for UI |
sendTimeslipDataToUi | () | Push timeslip to UI |
screenshotTimeslip | () | Take timeslip screenshot |
clearTimeslip | () | Clear timeslip UI |
getHistory | (id) → table | Race history |
openHistoryScreen | (facility) | Open drag history UI with tether |
onMenuClosed | () | Remove tether |
closeMenu | () | Close all career menus |
cleanup | () | Stop race if active |
Opponent Generation
local opponents = gameplay_drag_dragBridge.generateOpponentsGroup(
vehId, -- reference vehicle
dialTime, -- target 1/4 mile time (nil = auto from vehicle data)
permissionRules, -- array of {path, allowedValues/value}
2, -- amount of opponents
0.5 -- time offset window (±)
)
-- Returns: {{model, config, paint}, ...}Vehicle permission rules filter by nested property paths:
local rules = {
{path = {"Type"}, allowedValues = {"Car", "Truck"}},
{path = {"Derby Class"}, value = "A"}
}Key Behaviors
loadDragDataForMissionperforms a complete lifecycle: clear → load strip → load prefabs → set context → set data → configure drag type extension- Opponent selection uses
core_vehicles.getConfigList()filtered by quarter-mile time within[dial - offset, dial + 0.1] openHistoryScreencreates a sphere tether in career mode that auto-closes the menu if the player walks away
Additional Exports
| Function | Signature | Description |
|---|---|---|
getHistory | (id) → table | Returns race history for a drag strip |
openHistoryScreen | (facility) | Opens drag history UI screen with tether |
onMenuClosed | () | Removes tether on menu close |
closeMenu | () | Closes all career menus |
cleanup | () | Stops active race and clears state |
getWinnersData | () → table | Returns winner data from utils |
generateHashFromFile | (vehicleId?) → string | Generates config hash for dial time lookup |
getDialTimes | () → table | Returns saved dial times |
M.cleanup | () | - |
M.clearRacers | () | - |
M.clearTimeslip | () | - |
M.closeMenu | () | - |
M.configureDragStrip | (dragStrip) | - |
M.createTimeslipData | () | - |
M.generateHashFromFile | (vehicleId) | - |
M.generateOpponentsGroup | (vehId, dial, vehiclePermissionRules, amount, offset) | - |
M.getActiveRacerId | () | - |
M.getAllDragStrips | () | - |
M.getData | () | - |
M.getDialTimes | () | - |
M.getDragIsStarted | () | - |
M.getDragRaceData | () | - |
M.getDragRaceRuntimeData | () | - |
M.getDragStripInfo | (dragStripId) | - |
M.getHistory | (id) | - |
M.getPlayerDragTimes | (vehicleId) | - |
M.getRacerData | (vehicleId) | - |
M.getTimers | (vehicleId) | - |
M.getWinnersData | () | - |
M.isDragRaceActive | () | - |
M.loadDragDataForMission | (filepath) | - |
M.loadDragStrip | (dragStripId) | - |
M.onMenuClosed | () | - |
M.openHistoryScreen | (facility) | - |
M.resetDragRace | () | - |
M.savePlayerDragTimes | (vehicleId, times) | - |
M.screenshotTimeslip | () | - |
M.sendTimeslipDataToUi | () | - |
M.setRacerDial | (vehicleId, dialValue) | - |
M.setRacersDial | (dials) | - |
M.setVehicles | (vehicleIds) | - |
M.setupRacer | (vehicleId, lane) | - |
M.startDragRace | (vehicleId, lane) | - |
M.startDragRaceActivity | (lane) | - |
M.stopDragRace | () | - |
M.unloadRace | () | - |
See Also
- drag/debug - Drag Race Debug Menu - Related reference
- drag/display - Christmas Tree & Display Signs - Related reference
- drag/general - Core Drag Race Manager - Related reference
- Gameplay Systems Guide - Guide
Drag Tree Display
Reference for `gameplay_drag_display`, which controls the visual Christmas tree lights and digital display signs on the drag strip, plus corresponding UI updates.
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