> For the complete documentation index, see [llms.txt](https://atiysus-organization.gitbook.io/aty-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atiysus-organization.gitbook.io/aty-scripts/weapon-editor/getting-started/workbenches.md).

# Workbenches

## Workbenches

A workbench is how a player reaches the workshop. You build them in game, they are stored in the database, they appear for everyone immediately, and each one is bound to whoever you say it is.

There is no `/gunsmith` command by default and no fixed workshop zone. This is the door.

### Placing one

You need the `lab` scope.

**1. Open the manager**

```
/gunsmithadmin
```

**2. Start a new workbench and pick its locations**

The placement flow asks for **two separate points**, in order:

| Point                  | What it is                            | Controls                                                                       |
| ---------------------- | ------------------------------------- | ------------------------------------------------------------------------------ |
| **Access point**       | Where the player stands and interacts | Aim, `[E]` to confirm · wheel = radius · `[Backspace]` cancel                  |
| **Weapon spawn point** | Where the weapon appears on the bench | Aim, `[E]` to confirm · arrows = heading · wheel = height · `[Backspace]` back |

{% hint style="info" %}
Two points, not one. On a real workbench the place a player stands is not the place the weapon sits. With a single point the player would end up standing inside the bench, or the weapon would float in mid-air.
{% endhint %}

**3. Choose the object**

Every workbench carries its own prop, picked while placing:

```
No object · Tool bench · Tool bench (small) · Tool chest · Table · Gun case
Gun rack · Gun locker · Gun locker (armoured) · Military crate · Ammo crate
```

**No object** is a real choice — use it when your map already has a bench there, or when you only want an interaction point.

**4. Choose who may use it**

| Access type | Who gets in                           |
| ----------- | ------------------------------------- |
| `public`    | Everyone                              |
| `job`       | Anyone with that job                  |
| `grade`     | That job, at or above a minimum grade |
| `citizen`   | One specific citizen ID               |

The rule is always enforced on the server, not in the UI.

**5. Name it and save**

The label is what appears on the interaction.

### Configuration

```lua
Config.Tables = {
    enabled          = true,
    adminScope       = 'lab',
    adminCommand     = 'gunsmithadmin',
    defaultProp      = 'prop_tool_bench02',
    defaultRadius    = 1.2,
    maxSpawnDistance = 15.0,
    props            = { ... },   -- 11 entries
}
```

| Key                | Default               | Description                                                           |
| ------------------ | --------------------- | --------------------------------------------------------------------- |
| `enabled`          | `true`                | Turns the whole workbench system off                                  |
| `adminScope`       | `'lab'`               | Scope required to place and remove benches                            |
| `adminCommand`     | `'gunsmithadmin'`     | The placement command                                                 |
| `props`            | 11 entries            | Selectable objects. Adding one is a config line — no UI change needed |
| `defaultProp`      | `'prop_tool_bench02'` | Pre-selected in the placement form                                    |
| `defaultRadius`    | `1.2`                 | Interaction radius, metres                                            |
| `maxSpawnDistance` | `15.0`                | Warn when the spawn point is this far from the access point           |

`maxSpawnDistance` is a warning, not a block. It exists to catch a spawn point accidentally dropped on the other side of the map, not to stop a deliberate layout.

### Removing one

The manager lists every workbench with its label, access rule and status. A workbench can be closed (`enabled = 0`) without deleting it, which is the right move for a business that shuts at night, and deleted outright when it is gone for good.

### Fixed workshop zones

The alternative is a fixed point in `Config.Zones`, referenced from `Config.Access.workshop.zones`:

```lua
Config.Zones = {
    ammunation_1 = { coords = vector3(22.0, -1107.0, 29.8), radius = 1.6, label = 'workshop' },
}
```

{% hint style="danger" %}
A fixed zone is open to **everyone** and obeys no job or grade rule. Combining one with the workbench system leaves a back door that silently defeats every restriction you set on your benches. `Config.Access.workshop.zones` is empty by default for that reason.
{% endhint %}

### Troubleshooting

**A new workbench only appears after a script restart.** Fixed in 1.0.1. Bench access depends on job and citizen identity, which is not resolved yet at the moment a player joins; the scan now re-runs when the player loads and whenever their job changes.

**The same bench appears two or three times over.** Fixed. Two refreshes arriving at once could each spawn the prop, leaving orphans behind. The symptom looks like it depends on player count, but the cause was concurrent refreshes.

**The object failed to load.** The placement flow says so and lets you continue without one. The workbench still works; it just has no prop.
