PartCondition Module Reference
Module defined in `lua/vehicle/partCondition.lua`. Tracks the long-term health, mileage (odometer), and visual wear of every installed vehicle part. Used by the career/campaign systems to persist vehicle condition across sessions — parts degrade over time and use, affecting both gameplay (repair costs, performance) and visuals (paint wear, rust). Supports condition snapshots for save/restore.
Module defined in lua/vehicle/partCondition.lua. Tracks the long-term health, mileage (odometer), and visual wear of every installed vehicle part. Used by the career/campaign systems to persist vehicle condition across sessions — parts degrade over time and use, affecting both gameplay (repair costs, performance) and visuals (paint wear, rust). Supports condition snapshots for save/restore.
See Also
- Beamstate: For structural damage.
- DamageOverview: Summary of all damage systems.
Public API
| Function | Signature | Description |
|---|---|---|
applyConditionSnapshot | (snapshotKey) , createConditionSnapshot(snapshotKey), deleteConditionSnapshots() (**callable**) | Snapshot logic for saving/restoring entire vehicle state. |
ensureConditionsInit | (...) (**callable**) | Fallback initialization. |
getConditions | () (**callable**) | Aggregates health/mileage for all parts. Returns result. |
getRootPartOdometerValue | () , getRootPartTripValue() (**callable**) | Odometer access. Returns odometer. |
initConditions | (partsCondition, fallbackOdometer, fallbackIntegrityValue, fallbackVisualValue, defaultPaints) (**hook**) | Primary health restoration point. |
reset | () (**hook**) | Reverts to spawn snapshot. |
setAllPartPaints | (paints, paintOdometer) (**callable**) | Universal visual aging update. |
setPartMeshPaints | (partId, paints) , setPartPaints(partId, paints, paintOdometer) (**callable**) | Direct material aging control. |
setResetSnapshotKey | (snapshotKey) (**callable**) | Sets the target for the reset hook. |
Usage Example
-- Get the condition of all installed parts
local conditions = partCondition.getConditions()
for partName, data in pairs(conditions) do
print(partName .. ": integrity=" .. data.integrityValue .. " visual=" .. data.visualValue)
end
-- Check odometer reading
local km = partCondition.getRootPartOdometerValue() / 1000
print("Vehicle odometer: " .. km .. " km")
-- Save and restore condition snapshots
partCondition.createConditionSnapshot("beforeRace")
-- ... race happens, damage occurs ...
partCondition.applyConditionSnapshot("beforeRace") -- Restore pre-race stateobj (Vehicle C++ Object)
The `obj` global is a C++ binding to the `Vehicle` object in the engine. It provides direct access to the vehicle's physical state and low-level physics modifications. This is the primary interface fo
Particlefilter Module Reference
Module defined in `lua/vehicle/particlefilter.lua`. Filters collision events to determine which impacts should trigger particle effects (sparks, dust, debris). Evaluates perpendicular velocity and penetration depth thresholds to avoid spawning particles for minor or irrelevant contacts.