API Reference GE Extensions core Hotlapping Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario
Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario race system and the new race system.
Function Signature Description M.startHotlapping()Enters edit mode: initializes path data, places first checkpoint at player position. M.stopHotlapping()Stops timer, clears path/race/marker data, exits edit mode. M.start()Starts the race timer. In edit mode, validates path, creates race+marker objects, plays checkpoint audio. M.stopTimer()Stops the timer and clears race/marker state. Returns to edit mode. M.skipLap(keepLapProgress?)Skips the current lap in the race data.
Function Signature Description M.addCheckPoint(cpPos?, cpDir?, cpRadius?)Adds a checkpoint. Defaults to player position/direction and auto-radius from nearby road width. M.clearAllCP()Removes all checkpoints and stops AI. M.changeRadius(sign)Changes all checkpoint radii: +1 increases, -1 decreases, 0 resets to auto-radius. Range: 1–15. M.setVisible(value)Shows/hides race markers and enables/disables waypoint audio. M.onCheckPointPassed(index)Hook: processes checkpoint passage, updates lap/CP counters.
Function Signature Description M.startAi()Sets up non-player vehicles to race along the path with AI. M.stopAi(respawn?)Stops AI vehicles; optionally respawns them to home position.
Function Signature Description M.setTime()Records current time data for the active lap/checkpoint, calculates diffs vs best lap. M.setEndTime()Finalizes timing for a completed lap. M.getTimeInfo() → tableReturns formatted normal + detail time info for UI display. M.getTimeInfoRaw() → tableReturns raw times table. M.formatMillis(ms, addSign?) → stringFormats milliseconds as MM:SS.mmm, optionally with +/- sign. M.getDiffColor(val) → stringReturns "red", "green", or "" based on diff sign. M.passTimeToGUI()Sends timing data to UI via HotlappingTimer guihook.
Function Signature Description M.save(filePath?)Saves path data as .race.json to gameplay/hotlapping/{level}/. M.load(filename)Loads a hotlap config from file. Supports old format migration. M.rename(oldName, newName)Renames a saved hotlap file. M.refreshTracklist() → tableReturns list of saved track names for the current level.
Function Description M.newRaceStartInitializes hotlapping from a new-style race object. M.newRacePathnodeReachedProcesses checkpoint/lap completion from new race events. M.newRaceLapSkippedMarks the current lap as skipped. M.newRaceStopStops the timer.
Function Description M.onRaceStartInitializes from scenario race with lap config. M.onRaceWaypointReachedProcesses waypoint passage from old scenario system. M.onRaceResultStores detailed times in scenario data.
Hook Purpose M.onGameStateUpdateCalled on GameStateUpdate event M.onMenuToggledCalled on MenuToggled event M.onScreenFadeStateCalled on ScreenFadeState event M.onPreRenderCalled on PreRender event M.onVehicleResettedCalled on VehicleResetted event M.onClientStartMissionresets the app on level load M.onClientEndMissionCalled on ClientEndMission event M.onExtensionUnloadedCalled on ExtensionUnloaded event M.onUpdate(dtReal, dtSim, dtRaw)Hook: per-frame update.
-- Start hotlapping in freeroam
core_hotlapping. startHotlapping ()
-- Add checkpoints at specific positions
core_hotlapping. addCheckPoint ( vec3 ( 100 , 200 , 30 ), vec3 ( 1 , 0 , 0 ), 8 )
core_hotlapping. addCheckPoint ( vec3 ( 150 , 250 , 30 ))
-- Drive through first checkpoint to start timing
-- Times are automatically tracked via onUpdate
-- Save the track
core_hotlapping. save ()
Path data uses gameplay/race/path module.
Race logic uses gameplay/race/race module.
Markers use scenario/race_marker module.
Supports branching scenarios (disables lap/CP comparisons).
Pause time is tracked and excluded from timing.
Auto-radius uses map.findClosestRoad() to match road width.