Skip to content

Commit

Permalink
Merge pull request #29434 from ifreund/workbench
Browse files Browse the repository at this point in the history
[RDY] Workbenches
  • Loading branch information
kevingranade authored Apr 18, 2019
2 parents 69dc10f + 23468c3 commit 231b31d
Show file tree
Hide file tree
Showing 32 changed files with 876 additions and 155 deletions.
3 changes: 2 additions & 1 deletion data/help/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"To craft items, press <press_craft>. There are seven categories: Weapons, Ammo, Food, Chemicals, Electronics, Armor, and Other. In each major category there are several smaller sub-categories. While a few items require no particular skill to create, the majority require you to have some knowledge. Sometimes a skilled survivor will work out a given recipe from her or his knowledge of the skill, but more often you will need reference material, commonly a book of some sort. Reading such references gives a chance to memorize recipes outright, and you can also craft while referring to the book: just have it handy when crafting. Different knowledge is useful for different applications:",
"-> Fabrication is the generic artisan skill, used for a wide variety of gear.\n-> Cooking, at low levels, is used for making tasty recipes; at higher levels, you have an understanding of chemistry and can make chemical weapons and beneficial elixirs.\n-> Tailoring is used to create basic clothing, and armor later on.\n-> Electronics lets you make a wide variety of tools with intricate uses.",
"In addition to the primary crafting skills, other skills may be necessary to create certain items. Traps, Marksmanship, and First Aid are all required for certain items.",
"Crafting an item with high difficulty may fail and possibly waste some materials. You should prepare spare material, just in case."
"Crafting an item with high difficulty may fail and possibly waste some materials. You should prepare spare material, just in case.",
"Crafting very large/heavy items or batches of items is best done at a workbench of some kind. You could use any ordinary table, or build your own out of metal to handle even heavier loads."
]
},
{
Expand Down
21 changes: 21 additions & 0 deletions data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,27 @@
"pre_special": "check_empty",
"post_terrain": "f_table"
},
{
"type": "construction",
"description": "Build Workbench",
"category": "FURN",
"required_skills": [ [ "fabrication", 3 ] ],
"time": 60,
"using": [ [ "welding_standard", 5 ] ],
"components": [ [ [ "pipe", 8 ] ], [ [ "sheet_metal", 2 ] ], [ [ "sheet_metal_small", 4 ] ] ],
"pre_special": "check_empty",
"post_terrain": "f_workbench"
},
{
"type": "construction",
"description": "Place Workbench",
"category": "FURN",
"required_skills": [ [ "fabrication", 0 ] ],
"time": 1,
"components": [ [ [ "workbench", 1 ] ] ],
"pre_special": "check_empty",
"post_terrain": "f_workbench"
},
{
"type": "construction",
"description": "Build Chair",
Expand Down
75 changes: 70 additions & 5 deletions data/json/furniture.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,9 @@
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "2x4", "count": [ 1, 3 ] }, { "item": "nail", "charges": [ 2, 6 ] }, { "item": "splinter", "count": 1 } ]
}
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.0, "mass": 100000, "volume": "100L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -888,7 +890,9 @@
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "2x4", "count": [ 2, 6 ] }, { "item": "nail", "charges": [ 4, 8 ] }, { "item": "splinter", "count": 1 } ]
}
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.0, "mass": 100000, "volume": "100L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -1005,7 +1009,9 @@
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "2x4", "count": [ 2, 6 ] }, { "item": "nail", "charges": [ 4, 8 ] }, { "item": "splinter", "count": 1 } ]
}
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.0, "mass": 100000, "volume": "100L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -4570,7 +4576,7 @@
"coverage": 60,
"required_str": -1,
"looks_like": "f_counter",
"flags": [ "TRANSPARENT", "PLACE_ITEM", "MOUNTABLE" ],
"flags": [ "TRANSPARENT", "PLACE_ITEM", "MOUNTABLE", "FLAT_SURF" ],
"deconstruct": {
"items": [
{ "item": "pipe", "count": [ 6, 12 ] },
Expand All @@ -4596,7 +4602,9 @@
{ "item": "cable", "charges": [ 1, 3 ] },
{ "item": "cu_pipe", "count": 1 }
]
}
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 150000, "volume": "150L" }
},
{
"type": "furniture",
Expand Down Expand Up @@ -5647,5 +5655,62 @@
{ "item": "scrap_copper", "count": [ 0, 2 ] }
]
}
},
{
"type": "furniture",
"id": "f_workbench",
"name": "workbench",
"description": "A sturdy workbench built out of metal. It is perfect for crafting large and heavy things.",
"symbol": "#",
"color": "red",
"move_cost_mod": 2,
"required_str": -1,
"looks_like": "f_lab_bench",
"flags": [ "TRANSPARENT", "PLACE_ITEM", "MOUNTABLE", "FLAT_SURF" ],
"deconstruct": {
"items": [
{ "item": "pipe", "count": [ 6, 8 ] },
{ "item": "sheet_metal", "count": 2 },
{ "item": "sheet_metal_small", "count": [ 2, 4 ] }
]
},
"max_volume": 4000,
"bash": {
"str_min": 35,
"str_max": 80,
"sound": "metal screeching!",
"sound_fail": "clang!",
"items": [
{ "item": "pipe", "count": [ 4, 6 ] },
{ "item": "sheet_metal", "count": [ 0, 1 ] },
{ "item": "sheet_metal_small", "count": [ 12, 24 ] },
{ "item": "steel_chunk", "count": [ 4, 8 ] },
{ "item": "scrap", "count": [ 12, 24 ] }
]
},
"examine_action": "workbench",
"workbench": { "multiplier": 1.2, "mass": 250000, "volume": "250L" }
},
{
"type": "furniture",
"id": "f_fake_bench_hands",
"name": "fake workbench hands",
"description": "This fake workbench holds the stats for working on a wielded item.",
"symbol": "#",
"color": "red",
"move_cost_mod": 2,
"required_str": -1,
"workbench": { "multiplier": 1.0, "mass": 30000, "volume": "30L" }
},
{
"type": "furniture",
"id": "f_fake_bench_ground",
"name": "fake workbench ground",
"description": "This fake workbench holds the stats for working on a item on the ground.",
"symbol": "#",
"color": "red",
"move_cost_mod": 2,
"required_str": -1,
"workbench": { "multiplier": 0.75, "mass": 50000, "volume": "100L" }
}
]
15 changes: 15 additions & 0 deletions data/json/items/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@
"category": "veh_parts",
"price": 20000
},
{
"type": "GENERIC",
"id": "workbench",
"name": "workbench",
"description": "A sturdy workbench built out of metal. It is perfect for crafting large and heavy things.",
"weight": 23000,
"to_hit": -8,
"color": "red",
"symbol": "0",
"material": [ "steel" ],
"volume": 42,
"bashing": 8,
"category": "veh_parts",
"price": 40000
},
{
"type": "GENERIC",
"id": "saddle",
Expand Down
14 changes: 14 additions & 0 deletions data/json/recipes/recipe_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,20 @@
"qualities": [ { "id": "HAMMER", "level": 1 } ],
"components": [ [ [ "2x4", 6 ] ], [ [ "nail", 8 ] ] ]
},
{
"type": "recipe",
"result": "workbench",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_PARTS",
"skill_used": "fabrication",
"difficulty": 3,
"time": 60000,
"reversible": true,
"decomp_learn": 1,
"autolearn": true,
"using": [ [ "welding_standard", 5 ] ],
"components": [ [ [ "pipe", 8 ] ], [ [ "sheet_metal", 2 ] ], [ [ "sheet_metal_small", 4 ] ] ]
},
{
"type": "recipe",
"result": "foot_crank",
Expand Down
35 changes: 31 additions & 4 deletions data/json/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -969,12 +969,13 @@
"item": "v_table",
"difficulty": 1,
"location": "center",
"flags": [ "CARGO", "OBSTACLE", "TOOL_WRENCH", "FLAT_SURF" ],
"flags": [ "CARGO", "OBSTACLE", "TOOL_WRENCH", "FLAT_SURF", "WORKBENCH" ],
"breaks_into": [
{ "item": "2x4", "count": [ 1, 6 ] },
{ "item": "splinter", "count": [ 4, 6 ] },
{ "item": "nail", "charges": [ 4, 7 ] }
]
],
"workbench": { "multiplier": 1.0, "mass": 80000, "volume": "80L" }
},
{
"type": "vehicle_part",
Expand All @@ -990,12 +991,38 @@
"item": "w_table",
"difficulty": 1,
"location": "center",
"flags": [ "CARGO", "OBSTACLE", "TOOL_WRENCH", "FLAT_SURF" ],
"flags": [ "CARGO", "OBSTACLE", "TOOL_WRENCH", "FLAT_SURF", "WORKBENCH" ],
"breaks_into": [
{ "item": "2x4", "count": [ 1, 6 ] },
{ "item": "splinter", "count": [ 4, 6 ] },
{ "item": "nail", "charges": [ 4, 7 ] }
]
],
"workbench": { "multiplier": 1.0, "mass": 80000, "volume": "80L" }
},
{
"type": "vehicle_part",
"id": "workbench",
"name": "workbench",
"symbol": "#",
"color": "red",
"broken_symbol": "#",
"broken_color": "light_gray",
"looks_like": "veh_table_wood",
"damage_modifier": 60,
"durability": 300,
"size": 20,
"item": "workbench",
"difficulty": 1,
"location": "center",
"flags": [ "CARGO", "OBSTACLE", "TOOL_WRENCH", "FLAT_SURF", "WORKBENCH" ],
"breaks_into": [
{ "item": "pipe", "count": [ 4, 6 ] },
{ "item": "sheet_metal", "count": [ 0, 1 ] },
{ "item": "sheet_metal_small", "count": [ 12, 24 ] },
{ "item": "steel_chunk", "count": [ 4, 8 ] },
{ "item": "scrap", "count": [ 12, 24 ] }
],
"workbench": { "multiplier": 1.2, "mass": 1500000, "volume": "150L" }
},
{
"type": "vehicle_part",
Expand Down
12 changes: 12 additions & 0 deletions data/json/vehicleparts/vp_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,17 @@
"type": "json_flag",
"context": [ "vehicle_part" ],
"info": "If the center of balance of your vehicle is between all the wheels, the vehicle will be able to move, provided it has an active engine or motor with enough power to move the vehicle."
},
{
"id": "FLAT_SURF",
"type": "json_flag",
"context": [ "vehicle_part" ],
"info": "This has a flat surface. It would be a nice place to eat."
},
{
"id": "WORKBENCH",
"type": "json_flag",
"context": [ "vehicle_part" ],
"info": "You can craft here."
}
]
4 changes: 3 additions & 1 deletion doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ List of known flags, used in both terrain.json and furniture.json
- ```FLAMMABLE_ASH``` Burns to ash rather than rubble.
- ```FLAMMABLE_HARD``` Harder to light on fire, but still possible.
- ```FLAT``` Player can build and move furniture on.
- ```FLAT_SURF``` Furniture or terrain or vehicle part with flat hard surface (ex. table, but not chair; tree stump, etc.).
- ```FLAT_SURF``` Furniture or terrain with a flat hard surface (e.g. table, but not chair; tree stump, etc.).
- ```GOES_DOWN``` Can use <kbd>></kbd> to go down a level.
- ```GOES_UP``` Can use <kbd><</kbd> to go up a level.
- ```HARVESTED``` Marks the harvested version of a terrain type (e.g. harvesting an apple tree turns it into a harvested tree, which later becomes an apple tree again).
Expand Down Expand Up @@ -513,6 +513,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```EVENTURN``` Only on during even turns.
- ```EXTRA_DRAG``` tells the vehicle that the part exerts engine power reduction.
- ```FAUCET```
- ```FLAT_SURF``` Part with a flat hard surface (e.g. table).
- ```FOLDABLE```
- ```FORGE``` Acts as a forge for crafting.
- ```FRIDGE``` Can refrigerate items.
Expand Down Expand Up @@ -579,6 +580,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```WASHING_MACHINE``` Can be used to wash filthy clothes en masse.
- ```WATER_WHEEL``` Recharges vehicle batteries when in flowing water.
- ```WINDOW``` Can see through this part and can install curtains over it.
- ```WORKBENCH``` Can craft at this part, must be paired with a workbench json entry.
## Ammo
Expand Down
16 changes: 11 additions & 5 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1632,8 +1632,8 @@ Optional message to be printed when a creature using the harvest definition is b

#### `entries`

Array of dictionaries defining possible items produced on butchering and their likelihood of being produced.
`drop` value should be the `id` string of the item to be produced.
Array of dictionaries defining possible items produced on butchering and their likelihood of being produced.
`drop` value should be the `id` string of the item to be produced.
Acceptable values are as follows:
`flesh`: the "meat" of the creature.
`offal`: the "organs" of the creature. these are removed when field dressing.
Expand All @@ -1644,7 +1644,7 @@ Acceptable values are as follows:

`type` value should be a string with the associated body part the item comes from.

`base_num` value should be an array with two elements in which the first defines the minimum number of the corresponding item produced and the second defines the maximum number.
`base_num` value should be an array with two elements in which the first defines the minimum number of the corresponding item produced and the second defines the maximum number.

`scale_num` value should be an array with two elements, increasing the minimum and maximum drop numbers respectively by element value * survival skill.

Expand All @@ -1662,14 +1662,16 @@ Acceptable values are as follows:
"color": "white",
"move_cost_mod": 2,
"required_str": 18,
"flags": ["TRANSPARENT", "BASHABLE", "FLAMMABLE_HARD"],
"flags": [ "TRANSPARENT", "BASHABLE", "FLAMMABLE_HARD" ],
"crafting_pseudo_item": "anvil",
"examine_action": "toilet",
"close": "f_foo_closed",
"open": "f_foo_open",
"bash": "TODO",
"deconstruct": "TODO",
"max_volume": 4000
"max_volume": 4000,
"examine_action": "workbench",
"workbench": { "multiplier": 1.1, "mass": 10000, "volume": "50L" }
}
```

Expand All @@ -1693,6 +1695,10 @@ Strength required to move the furniture around. Negative values indicate an unmo

(Optional) Id of an item (tool) that will be available for crafting when this furniture is range (the furniture acts as an item of that type).

#### `workbench`

(Optional) Can craft here. Must specify a speed multiplier, allowed mass, and allowed volume. Mass/volume over these limits incur a speed penalty. Must be paired with a `"workbench"` `examine_action` to function.

### Terrain

```C++
Expand Down
Loading

0 comments on commit 231b31d

Please sign in to comment.