# ⚠️ Warnings & Wear Tracking

⁉️ Manage maintenance warnings and track wear on various vehicle parts to ensure timely servicing and realistic vehicle behavior.

## ⚠️ Warnings

* **Change Warnings:**\
  Enable or disable maintenance warnings that notify players when parts need attention.\
  `Config.ChangeWarnings = true` \\

* **Warning Check Interval:**\
  Set how often (in seconds) the system checks for maintenance warnings.\
  `Config.WarningsInterval = 30` \\

* Maintenance Thresholds\
  The `Config.Thresholds` table defines the wear levels for each vehicle part and determines when warnings or required actions are triggered. Each part has a list of thresholds, each with a `value`, `severity`, and (optionally) an `action`. These thresholds control when players receive notifications or are required to perform maintenance.

  * **value**: The wear value at which this threshold is triggered.
  * **severity**: The level of warning (`error`, `warning`, `info`).
  * **action** (optional): The recommended or required action (e.g., `replace_immediately`, `replace_soon`, `replace_need`).

* Wear Tracking\
  Enable tracking for specific vehicle parts:
  * Spark Plugs
  * Oil and Oil Filter
  * Air Filter
  * Tires
  * Brakes
  * Suspension
  * Clutch\\

* **Check Vehicle Animation:**\
  Configure the animation and object used when players check vehicle condition.
  * Animation dictionary and name
  * Object to attach to player
  * Bone index for attachment

***

## 👀 Example configuration:

```lua
Config.ChangeWarnings   = true          -- Enable maintenance warnings
Config.WarningsInterval = 30            -- Warning check interval (seconds)

Config.Thresholds = {
    SparkPlugs = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },

    Oil = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 2, severity = 'warning', action = 'replace_soon' },
        { value = 3, severity = 'warning', action = 'replace_need' },
        { value = 5, severity = 'warning' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' },
        { value = 50, severity = 'info' }
    },

    OilFilter = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },

    AirFilter = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },

    Tires = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 2, severity = 'warning', action = 'replace_soon' },
        { value = 3, severity = 'warning', action = 'replace_need' },
        { value = 5, severity = 'warning', action = 'replace_need' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' },
        { value = 50, severity = 'info' }
    },

    Brakes = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },

    Suspension = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },

    Clutch = {
        { value = 1, severity = 'error', action = 'replace_immediately' },
        { value = 5, severity = 'warning', action = 'replace_soon' },
        { value = 10, severity = 'warning' },
        { value = 25, severity = 'info' }
    },
}

Config.WearTracking = {
    SparkPlugs  = true,
    Oil         = true,
    AirFilter   = true,
    Tires       = true,
    Brakes      = true,
    Suspension  = true,
    Clutch      = true
}

Config.CheckVehicle = {
    Animation = "base",
    AnimDict  = "amb@world_human_clipboard@male@base",
    Object    = "prop_notepad_01",
    Bone      = 60309
}
```
