> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-redm-cars/repair.md).

# Engine Repair

CAS RedM Cars field engine repair. Use a Repair Kit, open the hood, work through the stages with tools and a skill check, and bring a damaged engine back to 75%.

`cas-carrepair` lets any player with a **Repair Kit** fix a damaged engine by the roadside. A field repair brings the engine up to **75%**. The kit is used up when the repair is finished.

## Repairing an engine

1. Stand next to the car, turn its engine off and use the **Repair Kit** from your inventory.
2. Your character walks to the engine, sets a toolbox down and opens the hood.
3. They look the engine over. A panel shows the engine's health and the stages ahead.
4. Work through the stages. In each, a needle swings across a brass gauge: press **Space** while it is inside the marked zone.

   | Stage              | Tool in hand                       |
   | ------------------ | ---------------------------------- |
   | Tighten the Bolts  | Spanner                            |
   | Hammer It Straight | Hammer                             |
   | Oil the Works      | Oil can                            |
   | Clean the Engine   | Rag (heavily damaged engines only) |

   A miss slips with a clank and the stage starts again. You lose time, not the kit.
5. The hood closes, the engine is at 75% and its smoke stops. Your character wipes their hands and picks the toolbox up.

| Engine health | Stages | Checks per stage             |
| ------------- | ------ | ---------------------------- |
| 40% to 74%    | 3      | 2 to 3                       |
| 1% to 39%     | 4      | 2 to 3, smaller zone         |
| Dead (0%)     | 4      | One more each, smallest zone |

Press **Backspace** at any time to stop. The kit is kept and the engine stays as it was. Walking away, getting hurt, the car moving or someone starting its engine also stops the repair.

{% hint style="info" %}
Everything is decided by the server:

* whether you have a kit;
* whether the car is close, stopped, off and damaged;
* whether each stage took its time;
* when the kit is taken and the engine repaired.

A client cannot repair an engine on its own. Only one player can work on a car at a time.
{% endhint %}

## Getting kits

The item is `repair_kit` (see [Installation](/script-documentation/cas-redm-cars/installation.md)). Staff give it with VORP's `/additem <id> repair_kit 1`. To sell it, add `repair_kit` to any shop script your server uses.

## Settings (`cas-carrepair/config.lua`)

| Setting                                        | Default           | What it does                                                                 |
| ---------------------------------------------- | ----------------- | ---------------------------------------------------------------------------- |
| `Config.Framework` / `Config.Locale`           | `"auto"` / `"en"` | Framework and language                                                       |
| `Config.Item`                                  | `"repair_kit"`    | The usable item                                                              |
| `Config.Cap`                                   | 750               | The engine health a field repair reaches (1000 is new)                       |
| `Config.StartDistance` / `Config.KeepDistance` | 5 m / 6 m         | How close to the car to start, and to keep working                           |
| `Config.Keys`                                  | Space / Backspace | The skill check key and the stop key                                         |
| `Config.Spot` / `Config.SpotOverrides`         |                   | Where the mechanic stands at each car                                        |
| `Config.Check`                                 |                   | The needle's speed and how much faster it gets per hit                       |
| `Config.Stages`                                | 4                 | Each stage: its tool, hand position, animation, checks, least time and sound |
| `Config.Bands`                                 | 3                 | Which stages, zone width and extra checks by engine health                   |
| `Config.Anims` / `Config.Toolbox`              |                   | The moments around the stages and the toolbox prop                           |
