ScriptAI Module Reference
Module defined in `lua/vehicle/scriptai.lua`. Handles high-fidelity path recording and playback for cinematic sequences and scripted behavior.
Module defined in lua/vehicle/scriptai.lua. Handles high-fidelity path recording and playback for cinematic sequences and scripted behavior.
See Also
State Fields
| Variable | Description |
|---|---|
debugMode | Current visualization mode ("off", "path", "target", "all"). |
updateGFX | Active loop: either updateGFXrecord (capturing) or updateGFXfollow (playback PID). |
Public API
| Function | Signature | Description |
|---|---|---|
debugDraw | () (**hook**) | Renders trajectory and target points in 3D. |
getInitialSpawnPositionOrientation | (inScript, vehPosType, _timeOffset) (**callable**) | Calculates stable world transform to match script start. Returns multiple values. |
isDriving | () (**callable**) | Returns true if playback is active. |
scriptState | () (**callable**) | Returns status table (state, time, script-time, error). |
scriptStop | (centerWheel, engageParkingbrake) (**callable**) | Halts playback and resets inputs. |
setLogDataToCSV | (val) (**callable**) | Enables detailed telemetry logging to CSV. |
setSpeedDiffSmootherOutRate | (outRate) (**callable**) | Tunes the velocity-matching PID loop. |
startFollowing | (inScript, timeOffset, loopCounter, loopType, externalForce) (**callable**) | Starts high-fidelity playback with optional correction forces. Returns M. |
startRecording | (recordSpeed) (**callable**) | Begins per-frame position and time recording. |
stopRecording | () (**callable**) | Finalizes recording and returns path data. |
wheelToGroundDist | (pos, dir, up) (**callable**) | Utility for calculating stable vertical spawn offset. Returns dH. |
Recovery Module Reference
Module defined in `lua/vehicle/recovery.lua`. This module handles the vehicle's "Rewind" functionality, "Home" point management, and automatic repair logic. It maintains a historic log of vehicle posi
Sensors Module Reference
Module defined in `lua/vehicle/sensors.lua`. Provides real-time physical sensor data (G-forces, angular velocities, orientation) with optional temporal smoothing. Used by AI for driving decisions, by the UI for G-force meters, and by extensions for impact detection and stability monitoring. Reads directly from the C++ physics engine via FFI for maximum performance.