Drift UI Display
Reference for `gameplay_drift_display`, which manages all drift-related UI updates: score display, angle readout, combo timer, flash messages, wrong-way/out-of-bounds warnings, and drift zone completi
Reference for gameplay_drift_display, which manages all drift-related UI updates: score display, angle readout, combo timer, flash messages, wrong-way/out-of-bounds warnings, and drift zone completion notifications.
Dependencies
gameplay_drift_general, gameplay_drift_drift, gameplay_drift_scoring, ui_apps_genericMissionData
Exports
| Function | Signature | Description |
|---|---|---|
onUpdate | (dtReal, dtSim, dtRaw) | Push scores/angle/speed to UI, show warnings |
reset | () | Clear generic mission data |
onDriftCompletedScored | (data) | Flash "+ N points", update persistent score |
onDriftCrash | () | Show "Crashed!" fail message |
onDriftSpinout | () | Show "Spinout!" fail message |
onDonutDriftScored | (score) | Flash donut bonus message |
onNearPoleScored | (score) | Flash near-pole bonus |
onTightDriftScored | (score) | Flash drift-through bonus |
onHitPoleScored | (score) | Flash pole-hit bonus |
onDriftSpotCompleted | (data) | Show completion/new record message |
onDriftSpotFailed | (data) | Show failure reason message |
onDriftQuickMessageDisplay | (data) | Display score modifier popup |
onDriftPlVehReset | () | Reset realtime UI values |
onDriftCachedScoreReset | () | Reset cached score display |
onDriftScoreWrappedUp | (score) | Flash wrapped-up points total |
onNewDriftTierReached | (tierData) | Flash tier name |
onDriftContextChanged | (context) | Show/hide drift UI layout |
onDriftCruisingToggled | (value) | Toggle drift angle display for cruising |
onDriftDebugChanged | (value) | Hide UI layout when debug disabled |
onExtensionUnloaded | () | Clear realtime messages |
onFreeroamDriftZoneNewHighscore | () | Flash "New Highscore!" |
onSerialize / onDeserialized | (data) | Persist UI layout state |
getDriftDebugInfo | () → table | Debug toggle state |
UI Data Stream
The display pushes a guiData table via guihooks.queueStream("drift", guiData):
guiData = {
permanentScore = 1500, -- confirmed score
potentialScore = 2300, -- score if combo applies
realtimeCachedScoreFloored = 450, -- current drift cached score
realtimeCombo = 3, -- current combo multiplier
realtimeRemainingComboTime = 0.7, -- 0-1 progress to combo timeout
realtimeCreep = 0.45, -- 0-1 combo creep-up progress
realtimePerformanceFactor = 2.5, -- smoothed 0-4 quality indicator
realtimeAngle = 35, -- current drift angle (0 when not drifting)
realtimeAirSpeed = 85, -- kph during drift (0 when not drifting)
}How It Works
-- Context changes control UI visibility
-- "inFreeroamChallenge" or "inChallenge" → show drift apps
-- "inFreeroam" → hide drift apps
gameplay_drift_display.onDriftContextChanged("inFreeroamChallenge")
-- Warning priority: out-of-bounds > wrong-way
-- Both use ScenarioRealtimeDisplay for on-screen textFlash Messages
-- Sent via both legacy and container routing:
guihooks.trigger('DriftFlashMessage', {{msg, 1.5, 0, false}})
extensions.hook('onGameplayFlashMessage', {source='drift', data=...})Key Behaviors
- Drift angle display requires:
abs(angle) < maxAngle, oversteering, above min speed, on ground, not walking creepSmootherusesnewTemporalSmoothingNonLinear(50, 10, 0)for smooth combo meter animation- Remaining distance display uses
ui_apps_genericMissionData.setData()with category "drift" - Drift zone completion messages use
core_jobsystemfor timed display setDriftUILayouttoggles between'driftMission'and'freeroam'game states
Module Variables
| Variable | Type | Description |
|---|---|---|
M.dependencies | table | {"gameplay_drift_general", "gameplay_drift_drift", "gameplay_drift_scoring", "ui |
M.getIsThereAnyDriftUIAppDisplayed | any | getIsThereAnyDriftUIAppDisplayed |
M.getDriftDebugInfo | () | - |
M.onDeserialized | (data) | - |
M.onDonutDriftScored | (score) | - |
M.onDriftCachedScoreReset | () | - |
M.onDriftCompletedScored | (data) | - |
M.onDriftContextChanged | (context) | - |
M.onDriftCrash | () | - |
M.onDriftCruisingToggled | (value) | - |
M.onDriftDebugChanged | (value) | - |
M.onDriftPlVehReset | () | - |
M.onDriftQuickMessageDisplay | (data) | - |
M.onDriftScoreWrappedUp | (score) | - |
M.onDriftSpinout | () | - |
M.onDriftSpotCompleted | (data) | - |
M.onDriftSpotFailed | (data) | - |
M.onExtensionUnloaded | () | - |
M.onFreeroamDriftZoneNewHighscore | () | - |
M.onHitPoleScored | (score) | - |
M.onNearPoleScored | (score) | - |
M.onNewDriftTierReached | (tierData) | - |
M.onSerialize | () | - |
M.onTightDriftScored | (score) | - |
M.onUpdate | (dtReal, dtSim, dtRaw) | - |
M.reset | () | - |
See Also
- drift/bounds - Drift Zone Boundary Detection - Related reference
- drift/destination - Race Path & Wrong-Way Detection - Related reference
- drift/drift - Core Drift Detection Engine - Related reference
- Gameplay Systems Guide - Guide
Drift Race Path
Reference for `gameplay_drift_destination`, which tracks remaining distance along a race path and detects wrong-way driving.
Drift Detection Engine
Reference for `gameplay_drift_drift`, which is the central drift detection engine. Determines when the vehicle is drifting, tracks angle/speed/distance, detects crashes and spinouts, and provides all