DamageTracker Module Reference
Module defined in `lua/vehicle/damageTracker.lua`. This is the centralized system for reporting component damage and failure states. It handles update throttling to the UI and manages temporary damage
Module defined in lua/vehicle/damageTracker.lua. This is the centralized system for reporting component damage and failure states. It handles update throttling to the UI and manages temporary damage effects.
See Also
- DamageOverview: Summary of all damage systems.
- Beamstate: For physical structural damage.
Public API
| Function | Signature | Description |
|---|---|---|
damageTracker.getDamage | (group, name) | Returns the stored damage value or boolean state. Returns false or 0 if no damage record exists. Standard (group, name) Pairs: ("engine", ...): headGasketDamaged, pistonRingsDamaged, rodBearingsDamaged, oilpanLeak, radiatorLeak, coolantOverheating, starvedOfOil, engineLockedUp, impactDamage, oilLevelCritical, exhaustBroken. ("wheels", ...): tire[Name], brake[Name], brakeOverHeat[Name] (where [Name] is e.g. FL). ("powertrain", ...): [deviceName] (e.g., mainEngine, rearDiff). ("body", ...): FL, FR, ML, MR, RL, RR. |
damageTracker.setDamage | (group, name, value, notifyUI) | The primary method for reporting damage. Marks the module as dirty, triggering a UI update. |
damageTracker.setDamageTemporary | (group, name, value, timeoutValue, timeout, notifyUI) | Sets a damage state that automatically reverts after a specified duration. Used for temporary malfunctions or warnings. |
damageTracker.registerDamageUpdateCallback | (callback) | Subscribes a function to be called whenever damage data is synced to the UI. |
damageTracker.sendNow | () | Forces an immediate broadcast of current damage data to the UI and all registered callbacks, bypassing throttling. |
damageTracker.willSend | () | Returns true if no damage update is currently pending (timer at initial value) and a player is seated. Useful for knowing if a sendNow() call would actually trigger an immediate send. |
damageTracker.init | () / reset() | Standard lifecycle hooks. Clears all damage records, timeouts, and callbacks. |
damageTracker.updateGFX | (dt) | Dispatched by the engine. Handles update throttling (approx. 3Hz) and manages active temporary damage timeouts. |
Usage Example
if damageTracker.getDamage("engine", "radiatorLeak") then ... endController Module Reference
Module defined in `lua/vehicle/controller.lua`. This module manages the vehicle's logical controllers, such as shift logic, electronic stability control (ESC), and specialized auxiliary systems. It ha
Drivetrain Module Reference
Module defined in `lua/vehicle/drivetrain.lua`. Legacy compatibility proxy that mirrors modern powertrain and controller data into the old drivetrain API format. Exists to support older mods and scripts that read drivetrain state directly. New code should use the `powertrain` and `controller` modules instead.