Drag Practice Race
Reference for `gameplay_drag_dragTypes_dragPracticeRace`, which implements a single-player practice drag race with automatic cleanup.
Reference for gameplay_drag_dragTypes_dragPracticeRace, which implements a single-player practice drag race with automatic cleanup.
Overview
Practice races are the simplest drag type - a single racer runs the strip alone with no dial handicap. If the racer is disqualified, the race auto-resets after 3 seconds. In freeroam context, drag data is cleared after completion. This is the default drag type for freeroam POI-triggered races.
Dependencies
gameplay_drag_general, gameplay_drag_utils
Exports
| Function | Signature | Description |
|------
| M.dependencies | table | {"gameplay_drag_general", "gameplay_drag_utils"} |----|-----------|-------------|
| onExtensionLoaded | () | Caches module references, clears state |
| onUpdate | (dtReal, dtSim, dtRaw) | Main loop - runs phases, handles DQ/finish |
| startActivity | () | Begin the race with dial = 0 for all racers |
| resetDragRace | () | Reset race state and refresh dragData |
| jumpDescualifiedDrag | () | Empty stub (unused) |
Internals
| Symbol | Purpose |
|---|---|
hasActivityStarted | Gate for update loop |
dqTimer | Seconds since disqualification; resets at 3 s |
clearDelayTimer | 1 s delay before clearing data after finish |
shouldClearAfterFinish | Flag to trigger delayed clear |
How It Works
-- Practice race starts with zero dial for all racers
gameplay_drag_dragTypes_dragPracticeRace.startActivity()
-- internally: dials = {{vehId = racer.vehId, dial = 0}, ...}
-- onUpdate flow per frame:
-- 1. If shouldClearAfterFinish, wait 1s then clearDragData()
-- 2. For each racer:
-- a. If finished → mark completed, reset, optionally clear (freeroam)
-- b. updateRacer → run phase → advance if complete
-- c. Check boundary → reset if out of bounds
-- 3. If any racer disqualified → 3s timer → reset + clearKey Behaviors
- No dependency-based phase synchronisation (each racer advances independently)
- Disqualification triggers a 3-second countdown before auto-reset
- In freeroam context, a 1-second delay occurs after finish before full data clear
- Boundary checking calls
dUtils.isRacerInsideBoundary(racer)every frame; violation causes immediate reset - The single-racer finish immediately marks
dragData.isCompleted = true
Module Variables
| Variable | Type | Description |
|---|---|---|
M.dependencies | table | {"gameplay_drag_general", "gameplay_drag_utils"} |
M.jumpDescualifiedDrag | () | - |
M.onExtensionLoaded | () | - |
M.onUpdate | (dtReal, dtSim, dtRaw) | - |
M.resetDragRace | () | - |
M.startActivity | () | - |
See Also
- drag/dragTypes/bracketRace - Bracket Race Type - Related reference
- drag/dragTypes/headsUpDrag - Heads-Up Drag Race - Related reference
- Gameplay Systems Guide - Guide
Bracket Drag Race
Reference for `gameplay_drag_dragTypes_bracketRace`, which implements the bracket-style drag race where racers have a dial-in time and staggered starts.
Heads-Up Drag Race
Reference for `gameplay_drag_dragTypes_headsUpDrag`, which implements a two-racer heads-up drag race with no handicap.