# build.ron

> The build menu: barricades and what they take.

<!-- Generated by `zombye-server --docs`. Do not edit: change the game and generate again. -->

**The build menu: barricades and what they take.** Read by the game's rules: a change here changes how the game plays, and a world remembers the content it was made with.

File: `assets/data/build.ron`

## About this file

The build menu: what a survivor can build, and on what. Schema: zombye_sim::build::BuildDef (validated on load against items.ron; unknown fields are refused). All builds and numbers are our own. Shift+B opens the build menu; a door or window's right-click menu has its builds too.

```text
  id           lowercase letters, digits and _ (saves, tools and Intent::Build name builds by it)
  name         what it's called in the build menu and in notes
  description  a line for the build menu
  category     the build menu's section: Barricades (more to come: walls, floors, furniture, upgrades)
  on           what it goes on: Window (shut, open or broken) or Door (shut or broken)
  secs         seconds each piece takes (Handiwork makes it faster, as crafting)
  inputs       [(item: "id", count: n)]: used up by each piece (whole items, carried or held)
  tools        [Item("id")] or [Tag("tag")]: needed to hand, kept
  hp           hit points of each piece against zombies battering it (a shut door has 40, glass 6; a zombie does about 1 every 1.6 s)
  max          pieces it stacks up to on one window or door
  noise        metres putting a piece up is heard; break_noise, a piece battered down
  xp           Handiwork XP for each piece
  remove       taking a piece down again: secs, tools, what each piece gives back (returns), noise
```


## Fields

The file is a list of `BuildDef`, each in round brackets.

One thing a survivor can build. Seconds of play; counts of whole items; ours.

| Field | Type | What it is |
|---|---|---|
| `id` | `String` |  |
| `name` | `String` | What it's called in the build menu and in notes ("Board up a window"). |
| `description` | `String` | A line for the build menu. |
| `category` | `BuildCategory` |  |
| `on` | `BuildOn` |  |
| `secs` | `f32` | Seconds a piece takes (Handiwork makes it faster, as crafting). |
| `inputs` | `Vec<RecipeItem>` | Used up by each piece. |
| `tools` | `Vec<Tool>` | Needed to hand, kept. |
| `hp` | `f32` | Hit points of each piece, against zombies battering it. |
| `max` | `u8` | Pieces it stacks up to (planks on one window). |
| `noise` | `f32` | How far putting a piece up is heard (metres). |
| `break_noise` | `f32` | How far a piece battered down is heard. |
| `xp` | `f32` | Handiwork XP for each piece. |
| `remove` | `RemoveDef` |  |

### `BuildCategory`

Which part of the build menu a build is listed in.

| Value | What it means |
|---|---|
| `Barricades` | Boarding up windows and doors. |

### `BuildOn`

What a build is put on.

| Value | What it means |
|---|---|
| `Window` | A ground-floor window, shut, open or broken. |
| `Door` | A ground-floor door, shut or broken (an open one is shut first). |

### `RecipeItem`

Some of one item a recipe takes or makes.

| Field | Type | What it is |
|---|---|---|
| `item` | `String` | An item id (`items.ron`). |
| `count` | `u16` |  |

### `Tool`

Something a recipe needs to hand but doesn't use up.

| Value | What it means |
|---|---|
| `Item(String)` | This item (an id in `items.ron`). |
| `Tag(String)` | Any item with this tag (`cuts`, `fire`, ...). |

### `RemoveDef`

How a build comes down again, a piece at a time.

| Field | Type | What it is |
|---|---|---|
| `secs` | `f32` |  |
| `tools` | `Vec<Tool>` |  |
| `returns` | `Vec<RecipeItem>` | What each piece taken down gives back. |
| `noise` | `f32` | How far it's heard (metres). |

## As shipped

2 entries. Columns are the fields short enough for a table; the rest are in the file below.

| `id` | `name` | `break_noise` | `category` | `hp` | `max` | `noise` | `on` | `secs` | `tools` | `xp` |
|---|---|---|---|---|---|---|---|---|---|---|
| "board_window" | "Board up a window" | 30 | "Barricades" | 60 | 4 | 22 | "Window" | 5 | [Tag("hammers")] | 4 |
| "board_door" | "Board up a door" | 30 | "Barricades" | 60 | 5 | 22 | "Door" | 6 | [Tag("hammers")] | 4 |

## The file

<details>
<summary>The whole file as shipped</summary>

```ron
// The build menu: what a survivor can build, and on what. Schema: zombye_sim::build::BuildDef
// (validated on load against items.ron; unknown fields are refused). All builds and numbers are
// our own. Shift+B opens the build menu; a door or window's right-click menu has its builds too.
//
//   id           lowercase letters, digits and _ (saves, tools and Intent::Build name builds by it)
//   name         what it's called in the build menu and in notes
//   description  a line for the build menu
//   category     the build menu's section: Barricades (more to come: walls, floors, furniture, upgrades)
//   on           what it goes on: Window (shut, open or broken) or Door (shut or broken)
//   secs         seconds each piece takes (Handiwork makes it faster, as crafting)
//   inputs       [(item: "id", count: n)]: used up by each piece (whole items, carried or held)
//   tools        [Item("id")] or [Tag("tag")]: needed to hand, kept
//   hp           hit points of each piece against zombies battering it (a shut door has 40, glass 6; a zombie does about 1 every 1.6 s)
//   max          pieces it stacks up to on one window or door
//   noise        metres putting a piece up is heard; break_noise, a piece battered down
//   xp           Handiwork XP for each piece
//   remove       taking a piece down again: secs, tools, what each piece gives back (returns), noise
[
    // ---- Barricades -----------------------------------------------------------------------------
    // A plank nailed across a window from the side you stand on. Each one is a door's worth of
    // battering less than a door, four of them a good deal more; the window stays a window under
    // them (glass and all) when the last one goes.
    (id: "board_window", name: "Board up a window",
        description: "Nail a plank across the window. Up to four; zombies batter them down one by one.",
        category: Barricades, on: Window, secs: 5.0,
        inputs: [(item: "wooden_plank"), (item: "nail", count: 4)], tools: [Tag("hammers")],
        hp: 60.0, max: 4, noise: 22.0, break_noise: 30.0, xp: 4.0,
        remove: (secs: 4.0, tools: [Tag("pries")], returns: [(item: "wooden_plank")], noise: 12.0)),
    // The same across a shut or broken door: more planks for the bigger opening.
    (id: "board_door", name: "Board up a door",
        description: "Nail a plank across the door. Up to five; the door still has to be battered through once they're down.",
        category: Barricades, on: Door, secs: 6.0,
        inputs: [(item: "wooden_plank"), (item: "nail", count: 4)], tools: [Tag("hammers")],
        hp: 60.0, max: 5, noise: 22.0, break_noise: 30.0, xp: 4.0,
        remove: (secs: 5.0, tools: [Tag("pries")], returns: [(item: "wooden_plank")], noise: 12.0)),
]
```

</details>