> 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/garage.md).

# Garage

The CAS RedM Cars garage. Take cars out, put them away from the driver seat, recover lost or wrecked cars, staff impound, and add new garages.

`cas-garage` keeps every car bought at the dealership. It knows where each car is:

| State     | Meaning                                                                          |
| --------- | -------------------------------------------------------------------------------- |
| Stored    | In a garage, ready to take out                                                   |
| Out       | On the road (the list shows Active near the garage, Outside Garage farther away) |
| Lost      | Left on the road when its owner left the game, or gone from the world            |
| Destroyed | Wrecked, burnt out or sunk                                                       |
| Impounded | Taken by staff, waiting at the impound                                           |

The car's fuel, engine health, odometer and body condition are kept through all of these.

## Opening the garage

Walk to the garage entrance (map icon and a ring on the ground) and hold **R** to open it. The selected car is shown right there at the entrance with the camera circling it. While the page is open you are in a private view: no passing wagons, riders or other players. Your character is hidden until you close it.

The page shows your cars with their state, location, distance, mileage and the condition of the engine, body and fuel tank. You can also:

* rename a car;
* mark favourites;
* track a car (a waypoint and a map marker to it).

## Taking a car out

Pick a stored car and press **Retrieve Vehicle**. The page closes and the car is made at the entrance, with you standing next to it.

## Putting a car away

Drive up to the garage entrance, stop, and hold **R** (**Store Vehicle**). The car is put away with you in it: the screen fades, the car is gone and you are standing where you sat. The car must be yours and stopped, and your passengers must get out first.

You can also put a car away from the garage page: bring it within reach of the entrance and use **Store Current Vehicle**.

## Recovery

A car that is lost, destroyed or out far away (5 miles or more) can be recovered to the garage for a fee:

| Part of the fee                 | Amount        |
| ------------------------------- | ------------- |
| Base, by class                  | $60 to $120   |
| A wreck                         | + $150        |
| A car nobody knows the place of | + $20         |
| Towing                          | + $2 per mile |

A recovered car comes back with at least 25% fuel, 35% engine and 35% body.

## Impound

Staff stand next to a car and use `/impound [fee] [reason]`. The default fee is $65 and the default reason is "Left on a public road". The owner is told why and for how much. They release the car at a garage by paying the fee.

## One garage or many

`Config.LockToGarage = false` (the default): a stored car can be taken out at any garage and put away at any garage. Set it to `true` to allow a car out only at the garage it was put away at.

The garages match the dealerships (`saintdenis`, `blackwater`, `valentine`). A garage with `enabled = false` is not built. A car kept there is kept at `Config.DefaultGarage` instead. A car bought at a dealership is kept at its town's garage, or at the default one while that garage is not enabled.

### Adding a garage

1. Stand exactly where the car should stand, facing the way it should face, and run `/garagepos`. It prints an `entrance = vector4(...)` line to the F8 console.
2. In `Config.Garages`, put that line in the garage's entry and set `enabled = true`.
3. Restart `cas-garage`. This is safe with players online.

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

| Setting                                      | Default           | What it does                                                                                           |
| -------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------ |
| `Config.Framework` / `Config.Locale`         | `"auto"` / `"en"` | Framework and language                                                                                 |
| `Config.Keys.Open`                           | R (hold)          | Open Garage on foot, Store Vehicle in a car                                                            |
| `Config.Prompt`                              | 4 m / 15 m        | How close to the entrance on foot / in a car                                                           |
| `Config.PrivatePreview`                      | `true`            | The private view while the page is open (routing buckets from `PreviewBucketBase`, 140000)             |
| `Config.StoreRadius`                         | 18 m              | How close to the entrance a car must be to be put away                                                 |
| `Config.StoreMaxSpeed`                       | 1.5 m/s           | The car must be about stopped to be put away from the driver seat                                      |
| `Config.ActiveMiles` / `Config.RecoverMiles` | 0.25 / 5          | Active vs Outside Garage, and the distance from which recovery is offered                              |
| `Config.KeepSeconds`                         | 60                | How often a car that is out has its fuel, engine, odometer and place saved                             |
| `Config.DefaultCapacity`                     | 4                 | Slots per garage when the dealership does not say (it says per garage in its `Config.Garage.Capacity`) |
| `Config.Fees`                                |                   | Recovery fees by class, wreck and lost extras, per mile                                                |
| `Config.Recover`                             | 25 / 35 / 35      | The least fuel, engine and body a recovered car comes back with (%)                                    |
| `Config.Impound`                             | `impound`, $65    | The command, fee, reason, location and reach                                                           |
| `Config.Blip` / `Config.Marker`              | on                | The map icon and the ring at each entrance                                                             |
| `Config.DefaultGarage`                       | `"saintdenis"`    | Where cars of a garage that is not enabled are kept                                                    |
| `Config.LockToGarage`                        | `false`           | See above                                                                                              |
| `Config.Garages`                             |                   | Each garage: `id`, `enabled`, `name`, `town`, `entrance` and an optional `preview` spot                |
