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

# Public storage

Everything in <mark style="color:$primary;">config/public\_storage.lua</mark>. Public storage turns world props - post boxes, newspaper stands, recycle bins - into containers anyone can open. Every prop of a listed model becomes its own storage, and contents are shared, so anything a player leaves behind can be taken by the next person who walks up to it.

### Master settings

* `enabled` - `false` = no prop is ever interactable.
* `distance` - meters a player has to be within to open one.
* `cleanupDays` - days an untouched storage keeps its items, `0` = never cleaned.

```lua
Config.PublicStorage = {
    enabled = true,
    distance = 1.6,
    cleanupDays = 7,
    props = { ... }
}
```

### Prop groups

One entry per kind of prop. Every model listed in `props` becomes its own storage, so each post box on the map holds its own items - they are not shared between props.

* `label` - shown in the panel header when a player opens it.
* `props` - the prop models that belong to this group.
* `slots` - how many slots it holds in slot mode.
* `maxWeight` - capacity in grams.
* `grid` - the cell size used in grid mode.

```lua
post_box = {
    label = "Post Box",
    props = { "prop_postbox_01a" },
    slots = 4,
    maxWeight = 10000,
    grid = { cols = 4, rows = 2 }
}
```

### Blacklist

Optional. Blocks items from being stored in that group - either single item names or a whole item type. Remove the line to allow everything.

```lua
blacklist = { "weapon" }
```

### Random loot

Optional. Rolled once, the very first time that exact prop is opened by anyone on the server. After that it is a plain container - whatever players leave inside is what the next person finds.

Every entry is rolled on its own, so a storage can come up empty, with one item or with all of them.

* `name` - the item to give.
* `chance` - percent chance this entry is rolled at all.
* `min` and `max` - the amount, picked at random between the two.

```lua
randomItems = {
    { name = "cloth", chance = 35, min = 1, max = 2 },
    { name = "scrap_metal", chance = 25, min = 1, max = 2 }
}
```

### Storage and cleanup

Every storage that has been opened is saved in the `oph3z_inventory` table (sql) with the type `public`, so its contents survive restarts.

A storage nobody has touched for `cleanupDays` days is deleted along with its items. Opening one refreshes its timer, and a storage somebody is looking at right now is never cleaned. Set `cleanupDays` to `0` to keep every storage forever.
