> 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-advanced-inventory/crafting.md).

# Crafting and containers

Hand crafting recipes, combining two items by dropping one on the other, and pouches and boxes that hold their own items in CAS Advanced Inventory for RedM.

Everything on this page is set in `config/crafting.lua`.

## Hand crafting

Small things a rider can make anywhere, no bench needed. Open it with the **hammer** next to the sort button in the satchel, or with `/craft`.

```lua
Config.Recipes = {
  { id = 'roll_cigarette', label = 'Cigarette', item = 'cigarette', makes = 1, time = 3, category = 'tobacco',
    needs = { picadura = 1, rollingpaper = 1 }, tools = { matches = 1 } },
  { id = 'camp_stew', label = 'Meat Stew', item = 'consumable_meat_greavy', makes = 2, time = 20, category = 'food',
    needs = { meat = 2, carrots = 2, water = 1 }, tools = { campfire = 1 } },
}
```

| Field            | Meaning                        |
| ---------------- | ------------------------------ |
| `id`             | Unique recipe id               |
| `label`          | Name in the list               |
| `item` / `makes` | What it makes and how many     |
| `time`           | Seconds per batch              |
| `category`       | Groups the list                |
| `needs`          | Items used up: `name = amount` |
| `tools`          | Items needed but not used up   |

Players see what they can make, what is missing and how many batches they can afford, and can queue several at once. **A recipe whose items do not exist on your server is hidden**, so the shipped examples never show broken entries. `Config.HandCrafting = false` turns the whole feature off.

## Combining

Drop one item onto another (either order) to combine them. The rider is asked first.

```lua
Config.Combine = {
  { a = 'picadura', b = 'rollingpaper', result = 'cigarette', makes = 1, time = 3, label = 'Roll a cigarette?' },
  { a = 'bandage', b = 'alcohol', result = 'improved_bandage', makes = 1, time = 3, label = 'Clean the bandage with alcohol?' },
}
```

One of each is used unless you give amounts.

## Pouches and boxes

Items that hold their own small inventory (a small satchel, a large bag, a lockbox). Use one (right click, **OPEN**) to open it as a card next to the satchel. Put your own item names here, or add the shipped ones to your items. They are not in the stock VORP item list; on VORP:

```sql
INSERT INTO items (item, label, `limit`, can_remove, type, usable, groupId, metadata, `desc`, weight) VALUES
  ('small_satchel', 'Small Satchel', 5, 1, 'item_standard', 0, 1, '{}', 'A small bag with 6 slots of its own.', 0.5),
  ('large_bag', 'Large Bag', 5, 1, 'item_standard', 0, 1, '{}', 'A bag with 12 slots of its own.', 1.0),
  ('lockbox', 'Lockbox', 5, 1, 'item_standard', 0, 1, '{}', 'A box with 9 slots of its own.', 1.5);
```

```lua
Config.Containers = {
  small_satchel = { label = 'Small Satchel', slots = 6, cols = 3, maxWeight = 5.0, deny = { } },
  large_bag = { label = 'Large Bag', slots = 12, cols = 4, maxWeight = 15.0 },
  lockbox = { label = 'Lockbox', slots = 9, cols = 3, maxWeight = 10.0 },
}
```

* The contents travel with the item: give the pouch away and its contents go with it.
* A container cannot go inside another container, and weapons do not go in.
* `deny` lists items that may not be put in.
