> For the complete documentation index, see [llms.txt](https://alt0.gitbook.io/alt0-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alt0.gitbook.io/alt0-docs/alt0-metal-detecting/configuration.md).

# Configuration

Two files are left readable by escrow and meant to be edited: `config/config.lua` and `config/loot.lua`. The `bridge/` folder is readable too, for servers that run another framework or inventory.

## config/config.lua

| Setting                                | What it does                                                                                                                                 |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Debug`                         | Console prints, an on-screen note with the ground material under you, and the `/mdrot` and `/mdoff` commands to adjust the prop in your hand |
| `Config.VersionCheck`                  | Print in the server console when an update is out                                                                                            |
| `Config.Framework`, `Config.Inventory` | `'auto'` finds them, or name one (`qbx_core`, `qb-core`, `es_extended`; `ox_inventory`, `qb-inventory`)                                      |
| `Config.ItemName`                      | The item used to take the detector out and put it away (`metaldetector`)                                                                     |
| `Config.MaxDigsPerHour`                | Digs per player per hour, `0` for no limit (default 60)                                                                                      |
| `Config.TargetSearchDistance`          | How far around the player hidden spots are placed, in metres. The signal is 0% at this distance                                              |
| `Config.DigDistance`                   | How close the player must be to dig                                                                                                          |
| `Config.CooldownAfterDig`              | Milliseconds before the next signal can appear                                                                                               |
| `Config.MinDistanceBetweenSpots`       | Minimum distance from spots already dug                                                                                                      |
| `Config.AllowedMaterials`              | The ground the detector works on. Sand and dirt types by default; set a material to `false` or remove it to exclude it                       |
| `Config.Prop`                          | The detector in the hand: model, bone, position and rotation                                                                                 |
| `Config.HoldAnim`                      | The holding animation                                                                                                                        |
| `Config.Dig`                           | Shovel prop, digging animation, duration, and the skill check (`useSkillCheck`, `skillCheckDifficulty`)                                      |
| `Config.Audio`                         | The beep sound                                                                                                                               |

### Ground that does not count as sand

With `Config.Debug = true` a note appears whenever the ground under you changes, with its material number and whether it is allowed. To allow a ground type, add its number to `Config.AllowedMaterials`.

### Adjusting the detector in the hand

With `Config.Debug = true`, take the detector out and use `/mdrot x y z` and `/mdoff x y z` to rotate and move it live. Both print the values; copy them into `Config.Prop`.

## config/loot.lua

```lua
LootConfig.Rolls = { min = 1, max = 2 }          -- item rolls per dig
LootConfig.CashReward = { min = 15, max = 100, chance = 40.0 }

LootConfig.Items = {
    { name = 'aluminum_can', label = 'Crushed Soda Can', chance = 16.0, count = { min = 1, max = 3 } },
    -- ...
}
```

| Field    | Meaning                                                                                                                          |
| -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `name`   | The item in your inventory                                                                                                       |
| `label`  | What the player sees in the notification                                                                                         |
| `chance` | How likely compared with the other entries. A share of everything that can be found, so the numbers do not have to add up to 100 |
| `count`  | How many are given, between `min` and `max`                                                                                      |

Items your inventory does not know are left out when digging, and the console lists them at start. If nothing at all can be found, the player is told "Nothing but dirt this time".

## How digging is checked

The server records where and when a dig starts, and pays only when:

* the detector is still in the inventory,
* enough of the dig time has passed,
* the player is still near the spot where it began,
* the player is within their hourly limit.

A claim without a dig that began, a second claim for the same dig, or one sent from far away pays nothing.
