Rules
Defines race rule enforcement and penalties for track limit violations.
This system can:
Detect various track limit events (cuts, out-of-circuit, position gain, stopping)
Apply penalties such as time penalties, money fines, return position requirements, or disqualification
Global Settings
Enables or disables the entire rule/penalty system.
All rules are configured inside Config.Rules.Data and keyed by a TrackLimits.* type.
Config.Rules.Data[TrackLimits.SOME_RULE] = { ... }
Each rule entry supports:
Enabled (bool) → turn rule on/off
Rule-specific configuration values (timers, thresholds, etc.)
Penalties → list of penalties to apply when rule triggers
Penalties are processed in order and can include multiple types at once.
Penalty Types Used Here
Adds a time penalty (milliseconds).
Removes money from the player (currency amount).
Forces player to give back a gained position within a time limit, otherwise disqualify.
⚠️ Values are typically expressed in milliseconds for time-based penalties.
Track Limits Rules
1) TrackLimits.CHECKPOINT_CUT
Prevents players from leaving the circuit too close to the next checkpoint.
Enables checkpoint-cut detection.
How many ms before the next checkpoint the player is not allowed to go out of the circuit.
Penalties (Default)
Adds a +2.5s time penalty.
✅ Optional example (commented in config): money penalty can be added instead or alongside time.
2) TrackLimits.POSITION_CUT
Triggers when a player goes out of the circuit and gains a position in the same sector (between checkpoints).
Enables position-cut enforcement.
Penalties (Default)
Adds a +1.0s time penalty.
Player must return the position within 30s, otherwise disqualified.
3) TrackLimits.OUT_OF_CIRCUIT
Triggers if player stays out of the circuit for too long.
Enables out-of-circuit enforcement.
Max allowed out-of-circuit duration (ms).
Penalties (Default)
Adds a +5.0s time penalty.
Charges the player $1500.
4) TrackLimits.STOPPING_VEHICLE
Triggers if player stops the vehicle on track (or in prohibited area) for too long.
Enables vehicle stopping rule.
Time (ms) before showing a warning.
Time (ms) before disqualification.
You can enable/disable each rule independently via its Enabled flag.
Penalties can be combined (e.g., time + money).
Use Penalty.RETURN_POSITION if you want competitive enforcement against gaining advantage.
Last updated