From 824b0cd86e28aec8db92219772d19860da35fa16 Mon Sep 17 00:00:00 2001 From: Qrox Date: Sun, 26 Jan 2020 11:46:24 +0800 Subject: [PATCH 1/3] Migrate constructions to use int_id and string_id --- data/json/construction.json | 267 ++++++++++++++++++ .../mods/Aftershock/recipes/construction.json | 2 + .../constructions/crt_constructions.json | 10 + data/mods/Hydroponics/construction.json | 2 + data/mods/Magiclysm/recipes/construction.json | 1 + data/mods/blazemod/blaze_blob_construct.json | 2 + src/activity_handlers.cpp | 3 +- src/activity_handlers.h | 6 +- src/activity_item_handling.cpp | 30 +- src/clzones.cpp | 29 +- src/clzones.h | 10 +- src/construction.cpp | 167 ++++++++++- src/construction.h | 13 +- src/game.cpp | 3 +- src/iexamine.cpp | 3 +- src/init.cpp | 2 +- src/savegame_json.cpp | 9 +- src/string_id_null_ids.cpp | 1 + src/type_id.h | 4 + 19 files changed, 502 insertions(+), 62 deletions(-) diff --git a/data/json/construction.json b/data/json/construction.json index 241506f93cfc9..57ee858a89792 100644 --- a/data/json/construction.json +++ b/data/json/construction.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_deconstruct", "description": "Deconstruct Furniture", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -12,6 +13,7 @@ }, { "type": "construction", + "id": "constr_deconstruct_simple", "description": "Deconstruct Simple Furniture", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -24,6 +26,7 @@ }, { "type": "construction", + "id": "constr_crafting_spot", "description": "Make crafting spot", "category": "OTHER", "required_skills": [ ], @@ -35,6 +38,7 @@ }, { "type": "construction", + "id": "constr_pit_spiked", "description": "Spike Pit", "category": "DIG", "required_skills": [ [ "survival", 1 ] ], @@ -45,6 +49,7 @@ }, { "type": "construction", + "id": "constr_pit_glass", "description": "Glass Pit", "category": "DIG", "required_skills": [ [ "survival", 1 ] ], @@ -55,6 +60,7 @@ }, { "type": "construction", + "id": "constr_chop_trunk", "description": "Chop Tree Trunk Into Planks", "category": "FARM_WOOD", "required_skills": [ [ "survival", 2 ] ], @@ -66,6 +72,7 @@ }, { "type": "construction", + "id": "constr_improvised_shelter", "description": "Build Improvised Shelter", "category": "CONSTRUCT", "required_skills": [ [ "survival", 2 ] ], @@ -77,6 +84,7 @@ }, { "type": "construction", + "id": "constr_door_curtain", "description": "Build Door Curtain", "//": "Door frame not required", "category": "CONSTRUCT", @@ -95,6 +103,7 @@ }, { "type": "construction", + "id": "constr_beaded_door", "description": "Build Beaded Curtain", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -107,6 +116,7 @@ }, { "type": "construction", + "id": "constr_door_makeshift", "description": "Build Makeshift Door", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -119,6 +129,7 @@ }, { "type": "construction", + "id": "constr_door_frame", "description": "Build Door", "//": "Step 1: door frame", "category": "CONSTRUCT", @@ -131,6 +142,7 @@ }, { "type": "construction", + "id": "constr_door", "description": "Build Door", "//": "Step 2: door", "category": "CONSTRUCT", @@ -143,6 +155,7 @@ }, { "type": "construction", + "id": "constr_fill_water_sh", "description": "Fill Shallow Water With Dirt", "category": "CONSTRUCT", "required_skills": [ [ "survival", 1 ] ], @@ -154,6 +167,7 @@ }, { "type": "construction", + "id": "constr_fill_swater_sh", "description": "Fill Salt Water With Dirt", "category": "CONSTRUCT", "required_skills": [ [ "survival", 1 ] ], @@ -165,6 +179,7 @@ }, { "type": "construction", + "id": "constr_door_peep", "description": "Build Door", "//": "Step 3: peephole", "category": "CONSTRUCT", @@ -177,6 +192,7 @@ }, { "type": "construction", + "id": "constr_repair_door", "description": "Repair Wood Door", "//": "Repair the regular door", "category": "REPAIR", @@ -189,6 +205,7 @@ }, { "type": "construction", + "id": "constr_repair_door_peep", "description": "Repair Wood Door", "//": "Repair the peephole door", "category": "REPAIR", @@ -201,6 +218,7 @@ }, { "type": "construction", + "id": "constr_repair_rdoor", "description": "Repair Wood Door", "//": "Repair the reinforced door", "category": "REPAIR", @@ -213,6 +231,7 @@ }, { "type": "construction", + "id": "constr_door_boarded", "description": "Board Up Wood Door", "//": "regular door", "category": "REINFORCE", @@ -225,6 +244,7 @@ }, { "type": "construction", + "id": "constr_door_boarded_peep", "description": "Board Up Wood Door", "//": "peephole door", "category": "REINFORCE", @@ -237,6 +257,7 @@ }, { "type": "construction", + "id": "constr_door_boarded_damaged", "description": "Board Up Wood Door", "//": "boarded damaged door", "category": "REINFORCE", @@ -249,6 +270,7 @@ }, { "type": "construction", + "id": "constr_door_boarded_damaged_peep", "description": "Board Up Wood Door", "//": "boarded damaged peephole door", "category": "REINFORCE", @@ -261,6 +283,7 @@ }, { "type": "construction", + "id": "constr_rdoor_boarded", "description": "Board Up Wood Door", "//": "the reinforced doors", "category": "REINFORCE", @@ -273,6 +296,7 @@ }, { "type": "construction", + "id": "constr_rdoor_boarded_damaged", "description": "Board Up Wood Door", "//": "damaged reinforced doors", "category": "REINFORCE", @@ -285,6 +309,7 @@ }, { "type": "construction", + "id": "constr_rdoor", "description": "Reinforce Wood Door", "category": "REINFORCE", "required_skills": [ [ "fabrication", 3 ] ], @@ -296,6 +321,7 @@ }, { "type": "construction", + "id": "constr_mdoor_frame", "description": "Build Metal Door", "//": "step 1: door frame", "category": "CONSTRUCT", @@ -308,6 +334,7 @@ }, { "type": "construction", + "id": "constr_door_metal", "description": "Build Metal Door", "//": "Step 2: metal door", "category": "CONSTRUCT", @@ -324,6 +351,7 @@ }, { "type": "construction", + "id": "constr_door_metal_peep", "description": "Build Metal Door", "//": "Step 3: peephole", "category": "CONSTRUCT", @@ -336,6 +364,7 @@ }, { "type": "construction", + "id": "constr_window_empty", "description": "Build Window", "//": "Step 1: window frame", "category": "CONSTRUCT", @@ -348,6 +377,7 @@ }, { "type": "construction", + "id": "constr_window_no_curtains", "description": "Build Window", "//": "Step 2: window, no curtains", "category": "CONSTRUCT", @@ -359,6 +389,7 @@ }, { "type": "construction", + "id": "constr_window_domestic", "description": "Build Window", "//": "Step 3: window with curtains", "category": "CONSTRUCT", @@ -371,6 +402,7 @@ }, { "type": "construction", + "id": "constr_clean_broken_window", "description": "Clean Broken Window", "category": "REPAIR", "required_skills": [ [ "fabrication", 0 ] ], @@ -381,6 +413,7 @@ }, { "type": "construction", + "id": "constr_window_taped", "description": "Tape Up Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -392,6 +425,7 @@ }, { "type": "construction", + "id": "constr_window_domestic_taped", "description": "Tape Up Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -403,6 +437,7 @@ }, { "type": "construction", + "id": "constr_window_alarm_taped", "description": "Tape Up Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -414,6 +449,7 @@ }, { "type": "construction", + "id": "constr_window_no_curtains_taped", "description": "Tape Up Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -425,6 +461,7 @@ }, { "type": "construction", + "id": "constr_revert_window_taped", "description": "Remove Tape from Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -436,6 +473,7 @@ }, { "type": "construction", + "id": "constr_revert_window_domestic_taped", "description": "Remove Tape from Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -447,6 +485,7 @@ }, { "type": "construction", + "id": "constr_revert_window_alarm_taped", "description": "Remove Tape from Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -458,6 +497,7 @@ }, { "type": "construction", + "id": "constr_revert_window_no_curtains_taped", "description": "Remove Tape from Window", "//": "Need a recipe for each type of window tapable due to how code works", "category": "REINFORCE", @@ -469,6 +509,7 @@ }, { "type": "construction", + "id": "constr_window_boarded", "description": "Board Up Window", "//": "Board up normal window", "category": "REINFORCE", @@ -481,6 +522,7 @@ }, { "type": "construction", + "id": "constr_window_boarded_curtains", "description": "Board Up Window", "//": "Board up window with curtains", "category": "REINFORCE", @@ -494,6 +536,7 @@ }, { "type": "construction", + "id": "constr_window_boarded_noglass_empty", "description": "Board Up Window", "//": "Board up empty window", "category": "REINFORCE", @@ -506,6 +549,7 @@ }, { "type": "construction", + "id": "constr_window_boarded_noglass_frame", "description": "Board Up Window", "//": "Board up window frame only", "category": "REINFORCE", @@ -518,6 +562,7 @@ }, { "type": "construction", + "id": "constr_window_reinforced", "description": "Reinforce Boarded Window", "//": "For regular windows", "category": "REINFORCE", @@ -530,6 +575,7 @@ }, { "type": "construction", + "id": "constr_window_reinforced_noglass", "description": "Reinforce Boarded Window", "//": "For windows with no glass that were barricaded", "category": "REINFORCE", @@ -542,6 +588,7 @@ }, { "type": "construction", + "id": "constr_window_enhanced", "description": "Armor Reinforced Window", "//": "Armor up regular reinforced window", "category": "REINFORCE", @@ -554,6 +601,7 @@ }, { "type": "construction", + "id": "constr_window_enhanced_noglass", "description": "Armor Reinforced Window", "//": "When underlying window has no glass", "category": "REINFORCE", @@ -566,6 +614,7 @@ }, { "type": "construction", + "id": "constr_bars", "description": "Build Metal Bars", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ] ], @@ -578,6 +627,7 @@ }, { "type": "construction", + "id": "constr_wall_wattle_half", "description": "Build Wattle-and-Daub Wall", "//": "Step 1: half of a wall in an empty space", "category": "CONSTRUCT", @@ -596,6 +646,7 @@ }, { "type": "construction", + "id": "constr_wall_wattle", "description": "Build Wattle-and-Daub Wall", "//": "Step 2: complete the half made wall", "category": "CONSTRUCT", @@ -614,6 +665,7 @@ }, { "type": "construction", + "id": "constr_repair_wall_wattle", "description": "Repair Wattle-and-Daub Wall", "category": "REPAIR", "required_skills": [ [ "fabrication", 2 ], [ "survival", 2 ] ], @@ -631,6 +683,7 @@ }, { "type": "construction", + "id": "constr_wall_half_window_empty", "description": "Build Wood Wall", "//": "Step 1: half of a wall where a window used to be", "category": "CONSTRUCT", @@ -643,6 +696,7 @@ }, { "type": "construction", + "id": "constr_wall_half", "description": "Build Wood Wall", "//": "Step 1: frame wall in an empty space", "category": "CONSTRUCT", @@ -655,6 +709,7 @@ }, { "type": "construction", + "id": "constr_wall_wood", "description": "Build Wood Wall", "//": "Step 2: complete the half made wall by putting paneling on it", "category": "CONSTRUCT", @@ -667,6 +722,7 @@ }, { "type": "construction", + "id": "constr_repair_wall_wood", "description": "Repair Wood Wall", "//": "fix a chip", "category": "REPAIR", @@ -679,6 +735,7 @@ }, { "type": "construction", + "id": "constr_repair_wall_wood_chipped", "description": "Repair Wood Wall", "//": "fix the broken to chipped", "category": "REPAIR", @@ -691,6 +748,7 @@ }, { "type": "construction", + "id": "constr_wall_log_half", "description": "Build Log Wall", "//": "Step 1: half of a log wall", "category": "CONSTRUCT", @@ -703,6 +761,7 @@ }, { "type": "construction", + "id": "constr_wall_log", "description": "Build Log Wall", "//": "Step 2: Finish the log wall", "category": "CONSTRUCT", @@ -715,6 +774,7 @@ }, { "type": "construction", + "id": "constr_repair_wall_log", "description": "Repair Log Wall", "//": "Fix the chipped back to normal", "category": "REPAIR", @@ -727,6 +787,7 @@ }, { "type": "construction", + "id": "constr_repair_wall_log_chipped", "description": "Repair Log Wall", "//": "fix broken back to chipped", "category": "REPAIR", @@ -739,6 +800,7 @@ }, { "type": "construction", + "id": "constr_sandbag_half", "description": "Build Sandbag Wall", "//": "Step 1: Build sandbag barricade", "category": "CONSTRUCT", @@ -751,6 +813,7 @@ }, { "type": "construction", + "id": "constr_sandbag_wall", "description": "Build Sandbag Wall", "//": "Step 2: Finish the sandbag wall", "category": "CONSTRUCT", @@ -763,6 +826,7 @@ }, { "type": "construction", + "id": "constr_earthbag_half", "description": "Build Earthbag Wall", "//": "Step 1: Build earthbag barricade", "category": "CONSTRUCT", @@ -775,6 +839,7 @@ }, { "type": "construction", + "id": "constr_earthbag_wall", "description": "Build Earthbag Wall", "//": "Step 2: Finish the earthbag wall", "category": "CONSTRUCT", @@ -787,6 +852,7 @@ }, { "type": "construction", + "id": "constr_scrap_wall_halfway", "description": "Build Metal Wall", "//": "Step 1: foundation", "category": "CONSTRUCT", @@ -800,6 +866,7 @@ }, { "type": "construction", + "id": "constr_scrap_wall", "description": "Build Metal Wall", "//": "Step 2: finish wall", "category": "CONSTRUCT", @@ -813,6 +880,7 @@ }, { "type": "construction", + "id": "constr_brick_wall_halfway", "description": "Build Brick Wall", "//": "Step 1: start wall", "category": "CONSTRUCT", @@ -825,6 +893,7 @@ }, { "type": "construction", + "id": "constr_brick_wall", "description": "Build Brick Wall", "//": "Step 2: finish wall", "category": "CONSTRUCT", @@ -837,6 +906,7 @@ }, { "type": "construction", + "id": "constr_concrete", "description": "Build Concrete Floor", "//": "Builds a concrete floor from a pit.", "category": "CONSTRUCT", @@ -850,6 +920,7 @@ }, { "type": "construction", + "id": "constr_fill_pot", "description": "Fill Pit With Dirt", "//": "Fills a deep pit with dirt.", "category": "CONSTRUCT", @@ -863,6 +934,7 @@ }, { "type": "construction", + "id": "constr_woodchips", "description": "Make Woodchip Floor", "//": "Adds wood chippings to a shallow pit to prevent plants growing, or for looks.", "category": "CONSTRUCT", @@ -874,6 +946,7 @@ }, { "type": "construction", + "id": "constr_railroad_rubble", "description": "Make Gravel Floor", "//": "Covers the floor with pebbles. Used for constructing railroads.", "category": "CONSTRUCT", @@ -884,6 +957,7 @@ }, { "type": "construction", + "id": "constr_railroad_track_small", "description": "Build Straight Small Railroad Track", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -895,6 +969,7 @@ }, { "type": "construction", + "id": "constr_railroad_track_small_d", "description": "Build Diagonal Small Railroad Track", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -906,6 +981,7 @@ }, { "type": "construction", + "id": "constr_floor_noroof", "description": "Build Wooden Floor", "//": "Makes an outside wooden paving, similar to what would be used in patios.", "category": "CONSTRUCT", @@ -918,6 +994,7 @@ }, { "type": "construction", + "id": "constr_sconc_wall_halfway", "description": "Build Simple Concrete Wall", "//": "Step 1: foundation", "category": "CONSTRUCT", @@ -931,6 +1008,7 @@ }, { "type": "construction", + "id": "constr_sconc_wall", "description": "Build Simple Concrete Wall", "//": "Step 2: finish wall", "category": "CONSTRUCT", @@ -944,6 +1022,7 @@ }, { "type": "construction", + "id": "constr_reb_cage_strconc_wall", "description": "Build Reinforced Concrete Wall", "//": "Step 1: rebar cage", "category": "CONSTRUCT", @@ -956,6 +1035,7 @@ }, { "type": "construction", + "id": "constr_strconc_wall_halfway", "description": "Build Reinforced Concrete Wall", "//": "Step 2: foundation", "category": "CONSTRUCT", @@ -969,6 +1049,7 @@ }, { "type": "construction", + "id": "constr_strconc_wall", "description": "Build Reinforced Concrete Wall", "//": "Step 3: finish wall", "category": "CONSTRUCT", @@ -982,6 +1063,7 @@ }, { "type": "construction", + "id": "constr_reb_cage_column", "description": "Build Concrete Column", "//": "Step 1: rebar cage", "category": "CONSTRUCT", @@ -994,6 +1076,7 @@ }, { "type": "construction", + "id": "constr_column_halfway", "description": "Build Concrete Column", "//": "Step 2: foundation", "category": "CONSTRUCT", @@ -1007,6 +1090,7 @@ }, { "type": "construction", + "id": "constr_column", "description": "Build Concrete Column", "//": "Step 3: finish column", "category": "CONSTRUCT", @@ -1020,6 +1104,7 @@ }, { "type": "construction", + "id": "constr_scrap_floor", "description": "Build Metal Roof", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ] ], @@ -1033,6 +1118,7 @@ }, { "type": "construction", + "id": "constr_ov_smreb_cage_thconc_floor", "description": "Build Concrete Roof", "//": "Step 1: rebar cage & supports", "category": "CONSTRUCT", @@ -1045,6 +1131,7 @@ }, { "type": "construction", + "id": "constr_thconc_floor", "description": "Build Concrete Roof", "//": "Step 2: roof & floor", "category": "CONSTRUCT", @@ -1058,6 +1145,7 @@ }, { "type": "construction", + "id": "constr_ov_reb_cage_strconc_floor", "description": "Build Reinforced Concrete Roof", "//": "Step 1: rebar cage & supports", "category": "CONSTRUCT", @@ -1070,6 +1158,7 @@ }, { "type": "construction", + "id": "constr_strconc_floor_halfway", "description": "Build Reinforced Concrete Roof", "//": "Step 2: start roof & floor", "category": "CONSTRUCT", @@ -1083,6 +1172,7 @@ }, { "type": "construction", + "id": "constr_strconc_floor", "description": "Build Reinforced Concrete Roof", "//": "Step 3: finish roof & floor", "category": "CONSTRUCT", @@ -1096,6 +1186,7 @@ }, { "type": "construction", + "id": "constr_palisade", "description": "Build Palisade Wall", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "survival", 2 ] ], @@ -1117,6 +1208,7 @@ }, { "type": "construction", + "id": "constr_rock_wall_half", "description": "Build Stone Wall", "//": "Step 1: half the wall", "category": "CONSTRUCT", @@ -1129,6 +1221,7 @@ }, { "type": "construction", + "id": "constr_rock_wall", "description": "Build Stone Wall", "//": "Step 2: the full wall", "category": "CONSTRUCT", @@ -1141,6 +1234,7 @@ }, { "type": "construction", + "id": "constr_drystone_wall_half", "description": "Build Dry Stone Wall", "//": "Step 1: half the wall", "category": "CONSTRUCT", @@ -1153,6 +1247,7 @@ }, { "type": "construction", + "id": "constr_drystone_wall", "description": "Build Dry Stone Wall", "//": "Step 2: the full wall", "category": "CONSTRUCT", @@ -1165,6 +1260,7 @@ }, { "type": "construction", + "id": "constr_ponywall", "description": "Build Pony Wall", "//": "a thin half-wall used to divide rooms.", "category": "CONSTRUCT", @@ -1177,6 +1273,7 @@ }, { "type": "construction", + "id": "constr_floor", "description": "Build Roof", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 3 ] ], @@ -1189,6 +1286,7 @@ }, { "type": "construction", + "id": "constr_dirtfloor_thatchroof", "description": "Build Thatched Roof", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 3 ], [ "survival", 7 ] ], @@ -1200,6 +1298,7 @@ }, { "type": "construction", + "id": "constr_floor_primitive", "description": "Build Log & Sod Roof", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -1217,6 +1316,7 @@ }, { "type": "construction", + "id": "constr_dirtfloor", "description": "Build Roof Over Dirt Floor", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 3 ] ], @@ -1229,6 +1329,7 @@ }, { "type": "construction", + "id": "constr_palisade_pulley", "description": "Build Rope & Pulley System", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ], [ "mechanics", 2 ] ], @@ -1240,6 +1341,7 @@ }, { "type": "construction", + "id": "constr_palisade_gate", "description": "Build Palisade Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "survival", 2 ] ], @@ -1252,6 +1354,7 @@ }, { "type": "construction", + "id": "constr_fence_post", "description": "Build Fence Posts", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 0 ], [ "survival", 0 ] ], @@ -1263,6 +1366,7 @@ }, { "type": "construction", + "id": "constr_fence", "description": "Build Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -1274,6 +1378,7 @@ }, { "type": "construction", + "id": "constr_fencegate", "description": "Build Fence Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -1285,6 +1390,7 @@ }, { "type": "construction", + "id": "constr_fence_rope", "description": "Build Rope Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -1295,6 +1401,7 @@ }, { "type": "construction", + "id": "constr_fence_wire", "description": "Build Wire Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -1305,6 +1412,7 @@ }, { "type": "construction", + "id": "constr_fence_barbed", "description": "Build Barbed Wire Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -1315,6 +1423,7 @@ }, { "type": "construction", + "id": "constr_chainfence_posts", "description": "Build Chainlink Fence", "//": "Step 1: fence posts", "category": "CONSTRUCT", @@ -1327,6 +1436,7 @@ }, { "type": "construction", + "id": "constr_chainfence", "description": "Build Chainlink Fence", "//": "Step 2: chainlink", "category": "CONSTRUCT", @@ -1338,6 +1448,7 @@ }, { "type": "construction", + "id": "constr_chaingate", "description": "Build Chainlink Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 3 ] ], @@ -1349,6 +1460,7 @@ }, { "type": "construction", + "id": "constr_screen_door", "description": "Build Screen Door", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -1361,6 +1473,7 @@ }, { "type": "construction", + "id": "constr_screened_porch_wall", "description": "Build Screen Mesh Wall", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -1373,6 +1486,7 @@ }, { "type": "construction", + "id": "constr_chickenwire_fence_post", "description": "Build Chickenwire Fence", "//": "Step 1: 2x4 stud frame", "category": "CONSTRUCT", @@ -1385,6 +1499,7 @@ }, { "type": "construction", + "id": "constr_chickenwire_fence", "description": "Build Chickenwire Fence", "//": "Step 2: chickenwire", "category": "CONSTRUCT", @@ -1396,6 +1511,7 @@ }, { "type": "construction", + "id": "constr_chickenwire_gate", "description": "Build Chickenwire Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -1407,6 +1523,7 @@ }, { "type": "construction", + "id": "constr_crate_c", "description": "Seal Crate", "category": "FURN", "required_skills": [ [ "mechanics", 0 ] ], @@ -1420,6 +1537,7 @@ }, { "type": "construction", + "id": "constr_crate_o", "description": "Build Crate", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1431,6 +1549,7 @@ }, { "type": "construction", + "id": "constr_coffin_o", "description": "Build Coffin", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1447,6 +1566,7 @@ }, { "type": "construction", + "id": "constr_coffin_c", "description": "Seal Coffin", "category": "FURN", "required_skills": [ [ "mechanics", 0 ] ], @@ -1459,6 +1579,7 @@ }, { "type": "construction", + "id": "constr_grave", "description": "Dig Grave and Bury Sealed Coffin", "category": "DIG", "required_skills": [ [ "fabrication", 0 ] ], @@ -1473,6 +1594,7 @@ }, { "type": "construction", + "id": "constr_bulletin", "description": "Build Bulletin Board", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1484,6 +1606,7 @@ }, { "type": "construction", + "id": "constr_dresser", "description": "Build Dresser", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -1495,6 +1618,7 @@ }, { "type": "construction", + "id": "constr_bookcase", "description": "Build Bookcase", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1506,6 +1630,7 @@ }, { "type": "construction", + "id": "constr_entertainment_center", "description": "Build Entertainment Center", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1517,6 +1642,7 @@ }, { "type": "construction", + "id": "constr_locker", "description": "Build Locker", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1528,6 +1654,7 @@ }, { "type": "construction", + "id": "constr_rack_wood", "description": "Build Wooden Rack", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1539,6 +1666,7 @@ }, { "type": "construction", + "id": "constr_rack", "description": "Build Metal Rack", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1550,6 +1678,7 @@ }, { "type": "construction", + "id": "constr_warehouse_shelf", "description": "Build Warehouse Shelf", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1561,6 +1690,7 @@ }, { "type": "construction", + "id": "constr_rack_coat", "description": "Build Coat Rack", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1572,6 +1702,7 @@ }, { "type": "construction", + "id": "constr_cupboard", "description": "Build Cupboard", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -1583,6 +1714,7 @@ }, { "type": "construction", + "id": "constr_counter", "description": "Build Counter", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1594,6 +1726,7 @@ }, { "type": "construction", + "id": "constr_table", "description": "Build Table", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1605,6 +1738,7 @@ }, { "type": "construction", + "id": "constr_place_table", "description": "Place Table", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1615,6 +1749,7 @@ }, { "type": "construction", + "id": "constr_coffee_table", "description": "Build Coffee Table", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1626,6 +1761,7 @@ }, { "type": "construction", + "id": "constr_workbench", "description": "Build Workbench", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -1637,6 +1773,7 @@ }, { "type": "construction", + "id": "constr_place_workbench", "description": "Place Workbench", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1647,6 +1784,7 @@ }, { "type": "construction", + "id": "constr_chair", "description": "Build Chair", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1658,6 +1796,7 @@ }, { "type": "construction", + "id": "constr_stool", "description": "Build Stool", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1669,6 +1808,7 @@ }, { "type": "construction", + "id": "constr_bench", "description": "Build Bench", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1680,6 +1820,7 @@ }, { "type": "construction", + "id": "constr_makeshift_bed", "description": "Build Makeshift Bed", "category": "FURN", "required_skills": [ [ "fabrication", 2 ] ], @@ -1695,6 +1836,7 @@ }, { "type": "construction", + "id": "constr_straw_bed", "description": "Build Straw Bed", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -1706,6 +1848,7 @@ }, { "type": "construction", + "id": "constr_leaves_pile", "description": "Build Pile of Leaves", "category": "FURN", "required_skills": [ [ "survival", 0 ] ], @@ -1717,6 +1860,7 @@ }, { "type": "construction", + "id": "constr_bed", "description": "Build Bed from Scratch", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1728,6 +1872,7 @@ }, { "type": "construction", + "id": "constr_bunkbed", "description": "Build Bunk Bed", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1744,6 +1889,7 @@ }, { "type": "construction", + "id": "constr_bed_frame", "description": "Build Bed Frame", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1755,6 +1901,7 @@ }, { "type": "construction", + "id": "constr_finish_bed", "description": "Add Mattress to Bed Frame", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1765,6 +1912,7 @@ }, { "type": "construction", + "id": "constr_armchair", "description": "Build Armchair", "category": "FURN", "required_skills": [ [ "fabrication", 3 ], [ "tailor", 3 ] ], @@ -1776,6 +1924,7 @@ }, { "type": "construction", + "id": "constr_sofa", "description": "Build Sofa", "category": "FURN", "required_skills": [ [ "fabrication", 4 ], [ "tailor", 3 ] ], @@ -1787,6 +1936,7 @@ }, { "type": "construction", + "id": "constr_sign", "description": "Build Sign", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 0 ] ], @@ -1798,6 +1948,7 @@ }, { "type": "construction", + "id": "constr_fireplace", "description": "Build Stone Fireplace", "category": "FURN", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -1809,6 +1960,7 @@ }, { "type": "construction", + "id": "constr_woodstove", "description": "Build Wood Stove", "category": "FURN", "required_skills": [ [ "fabrication", 5 ], [ "mechanics", 3 ] ], @@ -1820,6 +1972,7 @@ }, { "type": "construction", + "id": "constr_fvat_empty", "description": "Build Fermenting Vat", "category": "FURN", "required_skills": [ [ "fabrication", 2 ], [ "cooking", 3 ] ], @@ -1831,6 +1984,7 @@ }, { "type": "construction", + "id": "constr_wood_keg", "description": "Build Wooden Keg", "category": "FURN", "required_skills": [ [ "fabrication", 2 ], [ "cooking", 2 ] ], @@ -1842,6 +1996,7 @@ }, { "type": "construction", + "id": "constr_standing_tank", "description": "Build Standing Tank", "//": "a freestanding metal tank, useful for holding liquids", "category": "FURN", @@ -1859,6 +2014,7 @@ }, { "type": "construction", + "id": "constr_forge", "description": "Place Forge", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1870,6 +2026,7 @@ }, { "type": "construction", + "id": "constr_still", "description": "Place Still", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], @@ -1881,6 +2038,7 @@ }, { "type": "construction", + "id": "constr_covered_well", "description": "Build Water Well", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "survival", 4 ] ], @@ -1892,6 +2050,7 @@ }, { "type": "construction", + "id": "constr_water_pump", "description": "Build Water Well", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "mechanics", 2 ] ], @@ -1903,6 +2062,7 @@ }, { "type": "construction", + "id": "constr_hay", "description": "Place Hay Bale", "category": "FURN", "required_skills": [ [ "survival", 0 ] ], @@ -1913,6 +2073,7 @@ }, { "type": "construction", + "id": "constr_desk", "description": "Build Desk", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1924,6 +2085,7 @@ }, { "type": "construction", + "id": "constr_wardrobe", "description": "Build Wardrobe", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1935,6 +2097,7 @@ }, { "type": "construction", + "id": "constr_safe", "description": "Build Safe", "category": "FURN", "required_skills": [ [ "fabrication", 9 ] ], @@ -1957,6 +2120,7 @@ }, { "type": "construction", + "id": "constr_dumpster", "description": "Build Dumpster", "category": "FURN", "required_skills": [ [ "fabrication", 6 ] ], @@ -1969,6 +2133,7 @@ }, { "type": "construction", + "id": "constr_mailbox", "description": "Build Mailbox", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -1981,6 +2146,7 @@ }, { "type": "construction", + "id": "constr_door_bar", "description": "Build Bar Door", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 6 ] ], @@ -1993,6 +2159,7 @@ }, { "type": "construction", + "id": "constr_window_bars", "description": "Install Bars Onto Window", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ] ], @@ -2005,6 +2172,7 @@ }, { "type": "construction", + "id": "constr_window_bars_no_curtains", "description": "Install Bars Onto Window", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ] ], @@ -2017,6 +2185,7 @@ }, { "type": "construction", + "id": "constr_window_bars_alarm", "description": "Install Bars Onto Window", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 5 ] ], @@ -2029,6 +2198,7 @@ }, { "type": "construction", + "id": "constr_window_bars_curtains", "description": "Install Bars Onto Window", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -2040,6 +2210,7 @@ }, { "type": "construction", + "id": "constr_support_l", "description": "Build Large Metal Support", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 9 ] ], @@ -2052,6 +2223,7 @@ }, { "type": "construction", + "id": "constr_support_s", "description": "Build Small Metal Support", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 8 ] ], @@ -2064,6 +2236,7 @@ }, { "type": "construction", + "id": "constr_grass_white", "description": "Paint Grass White", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2075,6 +2248,7 @@ }, { "type": "construction", + "id": "constr_grass_white_dead", "description": "Paint Grass White", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2086,6 +2260,7 @@ }, { "type": "construction", + "id": "constr_grass_white_golf", "description": "Paint Grass White", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2097,6 +2272,7 @@ }, { "type": "construction", + "id": "constr_pavement_y", "description": "Paint Pavement Yellow", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2108,6 +2284,7 @@ }, { "type": "construction", + "id": "constr_pavement_y_bg_dp", "description": "Paint Pavement Yellow", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2119,6 +2296,7 @@ }, { "type": "construction", + "id": "constr_revert_pavement_y", "description": "Take Paint Off Pavement", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2129,6 +2307,7 @@ }, { "type": "construction", + "id": "constr_revert_pavement_y_bg_dp", "description": "Take Paint Off Pavement", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2139,6 +2318,7 @@ }, { "type": "construction", + "id": "constr_railing", "description": "Build Wooden Railing", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ] ], @@ -2150,6 +2330,7 @@ }, { "type": "construction", + "id": "constr_manhole_cover", "description": "Cover Manhole", "category": "CONSTRUCT", "required_skills": [ [ "mechanics", 0 ] ], @@ -2160,6 +2341,7 @@ }, { "type": "construction", + "id": "constr_revert_floor_waxed_y", "description": "Remove Wax From Floor", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2170,6 +2352,7 @@ }, { "type": "construction", + "id": "constr_wall_r", "description": "Paint Wall Red", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2181,6 +2364,7 @@ }, { "type": "construction", + "id": "constr_wall_b", "description": "Paint Wall Blue", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2192,6 +2376,7 @@ }, { "type": "construction", + "id": "constr_wall_w", "description": "Paint Wall White", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2203,6 +2388,7 @@ }, { "type": "construction", + "id": "constr_wall_g", "description": "Paint Wall Green", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2214,6 +2400,7 @@ }, { "type": "construction", + "id": "constr_wall_p", "description": "Paint Wall Purple", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2225,6 +2412,7 @@ }, { "type": "construction", + "id": "constr_wall_y", "description": "Paint Wall Yellow", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2236,6 +2424,7 @@ }, { "type": "construction", + "id": "constr_revert_wall_paint", "description": "Take Paint Off Wall", "//": "For vertical walls", "category": "DECORATE", @@ -2247,6 +2436,7 @@ }, { "type": "construction", + "id": "constr_revert_carpet", "description": "Remove Carpet", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2257,6 +2447,7 @@ }, { "type": "construction", + "id": "constr_carpet_red", "description": "Carpet Floor Red", "category": "DECORATE", "required_skills": [ [ "fabrication", 1 ] ], @@ -2268,6 +2459,7 @@ }, { "type": "construction", + "id": "constr_carpet_purple", "description": "Carpet Floor Purple", "category": "DECORATE", "required_skills": [ [ "fabrication", 1 ] ], @@ -2279,6 +2471,7 @@ }, { "type": "construction", + "id": "constr_carpet_yellow", "description": "Carpet Floor Yellow", "category": "DECORATE", "required_skills": [ [ "fabrication", 1 ] ], @@ -2290,6 +2483,7 @@ }, { "type": "construction", + "id": "constr_carpet_green", "description": "Carpet Floor Green", "category": "DECORATE", "required_skills": [ [ "fabrication", 1 ] ], @@ -2301,6 +2495,7 @@ }, { "type": "construction", + "id": "constr_floor_waxed", "description": "Wax Floor", "category": "DECORATE", "required_skills": [ [ "fabrication", 1 ] ], @@ -2312,6 +2507,7 @@ }, { "type": "construction", + "id": "constr_revert_floor_waxed", "description": "Remove Wax From Floor", "category": "DECORATE", "required_skills": [ [ "fabrication", 0 ] ], @@ -2322,6 +2518,7 @@ }, { "type": "construction", + "id": "constr_dig_downstair", "description": "Dig Downstair", "category": "DIG", "required_skills": [ [ "fabrication", 5 ], [ "survival", 3 ] ], @@ -2339,6 +2536,7 @@ }, { "type": "construction", + "id": "constr_mine_downstair", "description": "Mine Downstair", "category": "DIG", "required_skills": [ [ "fabrication", 6 ], [ "survival", 4 ] ], @@ -2356,6 +2554,7 @@ }, { "type": "construction", + "id": "constr_repair_wood_stairs_up", "description": "Repair Wooden Staircase", "//": "Fix the broken back to normal", "category": "REPAIR", @@ -2369,6 +2568,7 @@ }, { "type": "construction", + "id": "constr_wood_stairs_up_half", "description": "Build Wooden Staircase", "//": "Step 1: stairs frame in an empty space", "category": "CONSTRUCT", @@ -2381,6 +2581,7 @@ }, { "type": "construction", + "id": "constr_wood_stairs_up", "description": "Build Wooden Staircase", "//": "Step 2: complete the half made stairs by putting paneling on it", "category": "CONSTRUCT", @@ -2394,6 +2595,7 @@ }, { "type": "construction", + "id": "constr_mine_upstair", "description": "Mine Upstair", "category": "DIG", "required_skills": [ [ "fabrication", 6 ], [ "survival", 4 ] ], @@ -2428,6 +2630,7 @@ }, { "type": "construction", + "id": "constr_veh", "description": "Start Vehicle Construction", "//": "no components required, they are filled in at runtime based on the vehicle parts that can be used to start a vehicle", "category": "OTHER", @@ -2440,6 +2643,7 @@ }, { "type": "construction", + "id": "constr_barricade_road", "description": "Build Road Barricade", "category": "OTHER", "required_skills": [ [ "fabrication", 1 ] ], @@ -2451,6 +2655,7 @@ }, { "type": "construction", + "id": "constr_pontoon_dp", "description": "Build Pontoon Bridge", "//": "Set up pontoon bridge", "category": "CONSTRUCT", @@ -2467,6 +2672,7 @@ }, { "type": "construction", + "id": "constr_riverbridge_dp", "description": "Build River Bridge", "//": "Set up River bridge", "category": "CONSTRUCT", @@ -2484,6 +2690,7 @@ }, { "type": "construction", + "id": "constr_dock", "description": "Build River Dock/Shallow Bridge", "//": "Set up dock", "category": "CONSTRUCT", @@ -2496,6 +2703,7 @@ }, { "type": "construction", + "id": "constr_dock_deep_pile", "description": "Build Deep River Dock", "//": "Step 1: securing a pile down on the riverbed; not easy work without machinery", "category": "CONSTRUCT", @@ -2508,6 +2716,7 @@ }, { "type": "construction", + "id": "constr_dock_deep_frame", "description": "Build Deep River Dock", "//": "Step 2: add a log frame atop the pile", "category": "CONSTRUCT", @@ -2520,6 +2729,7 @@ }, { "type": "construction", + "id": "constr_dock_deep", "description": "Build Deep River Dock", "//": "Step 3: Finish with a wood surface", "category": "CONSTRUCT", @@ -2532,6 +2742,7 @@ }, { "type": "construction", + "id": "constr_place_water_mill", "description": "Place Water Mill", "//": "Set up Water Mill", "category": "CONSTRUCT", @@ -2544,6 +2755,7 @@ }, { "type": "construction", + "id": "constr_place_wind_mill", "description": "Place Wind Mill", "//": "Set up Wind Mill", "category": "CONSTRUCT", @@ -2556,6 +2768,7 @@ }, { "type": "construction", + "id": "constr_sh_bridge", "description": "Build Shallow Temporary Bridge", "//": "Set up shallow bridge", "category": "CONSTRUCT", @@ -2568,6 +2781,7 @@ }, { "type": "construction", + "id": "constr_planter", "description": "Build Planter", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -2578,6 +2792,7 @@ }, { "type": "construction", + "id": "constr_cut_grass_long", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2589,6 +2804,7 @@ }, { "type": "construction", + "id": "constr_cut_grass_tall", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2600,6 +2816,7 @@ }, { "type": "construction", + "id": "constr_remove_grass", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2611,6 +2828,7 @@ }, { "type": "construction", + "id": "constr_remove_grass_long", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2622,6 +2840,7 @@ }, { "type": "construction", + "id": "constr_remove_grass_tall", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2633,6 +2852,7 @@ }, { "type": "construction", + "id": "constr_remove_grass_dead", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2644,6 +2864,7 @@ }, { "type": "construction", + "id": "constr_remove_grass_golf", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2654,6 +2875,7 @@ }, { "type": "construction", + "id": "constr_remove_grass_white", "description": "Remove Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2664,6 +2886,7 @@ }, { "type": "construction", + "id": "constr_extract_sand", "description": "Extract Sand", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2675,6 +2898,7 @@ }, { "type": "construction", + "id": "constr_extract_clay", "description": "Extract Clay", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -2686,6 +2910,7 @@ }, { "type": "construction", + "id": "constr_kiln_empty", "description": "Build Charcoal Kiln", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -2698,6 +2923,7 @@ }, { "type": "construction", + "id": "constr_kiln_metal_empty", "description": "Build Metal Charcoal Kiln", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -2709,6 +2935,7 @@ }, { "type": "construction", + "id": "constr_smoking_rack", "description": "Build Smoking Rack", "category": "FURN", "required_skills": [ [ "fabrication", 3 ], [ "cooking", 2 ] ], @@ -2726,6 +2953,7 @@ }, { "type": "construction", + "id": "constr_forge_rock", "description": "Build Rock Forge", "category": "FURN", "required_skills": [ [ "fabrication", 5 ] ], @@ -2738,6 +2966,7 @@ }, { "type": "construction", + "id": "constr_clay_kiln", "description": "Build Clay Kiln", "category": "FURN", "required_skills": [ [ "fabrication", 4 ] ], @@ -2754,6 +2983,7 @@ }, { "type": "construction", + "id": "constr_m_frame", "description": "Build Reinforced Glass Window", "//": "Step 1 : metal frame", "category": "CONSTRUCT", @@ -2766,6 +2996,7 @@ }, { "type": "construction", + "id": "constr_reinforced_glass", "description": "Build Reinforced Glass Window", "//": "Step 2 : Reinforced Glass", "category": "CONSTRUCT", @@ -2778,6 +3009,7 @@ }, { "type": "construction", + "id": "constr_reinforce_glass_shutter", "description": "Build Reinforced Glass Window", "//": "Step 3 : Metal shutters", "category": "CONSTRUCT", @@ -2790,6 +3022,7 @@ }, { "type": "construction", + "id": "constr_rootcellar", "description": "Build Root Cellar", "category": "CONSTRUCT", "required_skills": [ [ "survival", 4 ], [ "fabrication", 4 ] ], @@ -2802,6 +3035,7 @@ }, { "type": "construction", + "id": "constr_firewood_source", "description": "Mark firewood source", "category": "OTHER", "required_skills": [ ], @@ -2813,6 +3047,7 @@ }, { "type": "construction", + "id": "constr_practice_target", "description": "Mark practice target", "category": "OTHER", "required_skills": [ ], @@ -2824,6 +3059,7 @@ }, { "type": "construction", + "id": "constr_butcher_rack", "description": "Build Butchering Rack", "category": "FURN", "required_skills": [ [ "fabrication", 1 ], [ "survival", 3 ] ], @@ -2840,6 +3076,7 @@ }, { "type": "construction", + "id": "constr_junk_palisade", "description": "Build Junk Metal Barrier", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -2860,6 +3097,7 @@ }, { "type": "construction", + "id": "constr_junk_wall_bolts", "description": "Reinforce Junk Metal Wall using bolts", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -2887,6 +3125,7 @@ }, { "type": "construction", + "id": "constr_junk_wall_spot_weld", "description": "Reinforce Junk Metal Wall using spot-welds", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -2909,6 +3148,7 @@ }, { "type": "construction", + "id": "constr_junk_floor", "description": "Build Junk Metal Floor", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ] ], @@ -2936,6 +3176,7 @@ }, { "type": "construction", + "id": "constr_pillow_fort", "description": "Build Pillow Fort", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 0 ] ], @@ -2950,6 +3191,7 @@ }, { "type": "construction", + "id": "constr_cardboard_fort", "description": "Build Cardboard Fort", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 0 ] ], @@ -2966,6 +3208,7 @@ }, { "type": "construction", + "id": "constr_firering", "description": "Build Fire Ring", "category": "FURN", "required_skills": [ [ "survival", 0 ] ], @@ -2977,6 +3220,7 @@ }, { "type": "construction", + "id": "constr_wall_rammed_earth", "description": "Build Rammed Earth Wall", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 2 ] ], @@ -2993,6 +3237,7 @@ }, { "type": "construction", + "id": "constr_hanging_meathook", "description": "Hang Hanging Meathook", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 1 ] ], @@ -3004,6 +3249,7 @@ }, { "type": "construction", + "id": "constr_counter_gate", "description": "Build Counter Gate", "category": "FURN", "required_skills": [ [ "fabrication", 1 ] ], @@ -3015,6 +3261,7 @@ }, { "type": "construction", + "id": "constr_splitrail_fencegate", "description": "Build Split Rail Fence Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -3026,6 +3273,7 @@ }, { "type": "construction", + "id": "constr_privacy_fencegate", "description": "Build Privacy Fence Gate", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -3037,6 +3285,7 @@ }, { "type": "construction", + "id": "constr_splitrail_fence", "description": "Build Split Rail Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -3048,6 +3297,7 @@ }, { "type": "construction", + "id": "constr_privacy_fence", "description": "Build Privacy Fence", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 2 ], [ "survival", 1 ] ], @@ -3059,6 +3309,7 @@ }, { "type": "construction", + "id": "constr_adobe_brick_wall_halfway", "description": "Build Brick Wall from Adobe", "//": "Step 1: start wall", "category": "CONSTRUCT", @@ -3076,6 +3327,7 @@ }, { "type": "construction", + "id": "constr_adobe_brick_wall", "description": "Build Brick Wall from Adobe", "//": "Step 2: finish wall", "category": "CONSTRUCT", @@ -3093,6 +3345,7 @@ }, { "type": "construction", + "id": "constr_wall_resin_cage", "description": "Extrude Resin Lattice", "category": "CONSTRUCT", "skill": "fabrication", @@ -3105,6 +3358,7 @@ }, { "type": "construction", + "id": "constr_wall_resin", "description": "Extrude Resin Wall", "category": "CONSTRUCT", "skill": "fabrication", @@ -3116,6 +3370,7 @@ }, { "type": "construction", + "id": "constr_floor_resin", "description": "Extrude Resin Floor and Roof", "category": "CONSTRUCT", "skill": "fabrication", @@ -3128,6 +3383,7 @@ }, { "type": "construction", + "id": "constr_platform_resin", "description": "Extrude Resin Floor (no roof)", "category": "CONSTRUCT", "skill": "fabrication", @@ -3140,6 +3396,7 @@ }, { "type": "construction", + "id": "constr_leanto", "skill": "survival", "description": "Build Pine Lean-To", "category": "CONSTRUCT", @@ -3152,6 +3409,7 @@ }, { "type": "construction", + "id": "constr_tarptent", "skill": "survival", "description": "Build Tarp Lean-To", "category": "CONSTRUCT", @@ -3165,6 +3423,7 @@ }, { "type": "construction", + "id": "constr_pit_shallow", "skill": "survival", "description": "Dig a Shallow Pit", "category": "CONSTRUCT", @@ -3177,6 +3436,7 @@ }, { "type": "construction", + "id": "constr_pit", "skill": "survival", "description": "Dig a Deep Pit", "category": "CONSTRUCT", @@ -3189,6 +3449,7 @@ }, { "type": "construction", + "id": "constr_arcfurnace", "description": "Build Arc Furnace", "category": "FURN", "required_skills": [ [ "fabrication", 3 ] ], @@ -3216,6 +3477,7 @@ }, { "type": "construction", + "id": "constr_bellows", "skill": "fabrication", "description": "Build a bellow.", "//": "faction camp workshop recipe", @@ -3230,6 +3492,7 @@ }, { "type": "construction", + "id": "constr_drophammer", "skill": "fabrication", "description": "Build a drop hammer.", "//": "faction camp workshop recipe", @@ -3244,6 +3507,7 @@ }, { "type": "construction", + "id": "constr_radio_tower", "skill": "fabrication", "description": "Build a radio tower.", "//": "faction camp workshop recipe", @@ -3276,6 +3540,7 @@ }, { "type": "construction", + "id": "constr_radio_controls", "skill": "fabrication", "description": "Build a radio tower console.", "//": "faction camp workshop recipe", @@ -3301,6 +3566,7 @@ }, { "type": "construction", + "id": "constr_logstool", "description": "Build Log Stool", "category": "FURN", "required_skills": [ [ "survival", 1 ] ], @@ -3312,6 +3578,7 @@ }, { "type": "construction", + "id": "constr_decorative_tree", "description": "Build Decorative Tree", "category": "FURN", "required_skills": [ [ "fabrication", 0 ] ], diff --git a/data/mods/Aftershock/recipes/construction.json b/data/mods/Aftershock/recipes/construction.json index c745b9ed71293..95ceb8b999d65 100644 --- a/data/mods/Aftershock/recipes/construction.json +++ b/data/mods/Aftershock/recipes/construction.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_afs_fridge_vehicle", "description": "Convert Fridge Power Supply", "category": "FURN", "required_skills": [ [ "fabrication", 3 ], [ "electronics", 4 ], [ "mechanics", 3 ] ], @@ -13,6 +14,7 @@ }, { "type": "construction", + "id": "constr_afs_freezer_vehicle", "description": "Convert Vehicle Fridge to Freezer", "category": "FURN", "required_skills": [ [ "electronics", 3 ], [ "mechanics", 3 ] ], diff --git a/data/mods/CRT_EXPANSION/constructions/crt_constructions.json b/data/mods/CRT_EXPANSION/constructions/crt_constructions.json index 40a2429acfdc8..3c6dc3aea4631 100644 --- a/data/mods/CRT_EXPANSION/constructions/crt_constructions.json +++ b/data/mods/CRT_EXPANSION/constructions/crt_constructions.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_crt_cut_grass_long", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -12,6 +13,7 @@ }, { "type": "construction", + "id": "constr_crt_cut_grass_tall", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -23,6 +25,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -34,6 +37,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass_long", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -45,6 +49,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass_tall", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -56,6 +61,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass_dead", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -67,6 +73,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass_golf", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -78,6 +85,7 @@ }, { "type": "construction", + "id": "constr_crt_remove_grass_white", "description": "Cut Grass", "category": "OTHER", "required_skills": [ [ "survival", 0 ] ], @@ -89,6 +97,7 @@ }, { "type": "construction", + "id": "constr_crt_chop_trunk", "description": "Chop Tree Trunk Into Logs", "category": "FARM_WOOD", "required_skills": [ [ "survival", 2 ] ], @@ -100,6 +109,7 @@ }, { "type": "construction", + "id": "constr_crt_wall_stick", "description": "Makeshift Wall", "category": "OTHER", "required_skills": [ [ "survival", 2 ] ], diff --git a/data/mods/Hydroponics/construction.json b/data/mods/Hydroponics/construction.json index 8d2d340f2db27..b441590ab4856 100644 --- a/data/mods/Hydroponics/construction.json +++ b/data/mods/Hydroponics/construction.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_hydroponics", "description": "Build Hydroponics", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "survival", 2 ], [ "electronics", 2 ] ], @@ -24,6 +25,7 @@ }, { "type": "construction", + "id": "constr_hydro_heater", "description": "Build Hydroponics Heater", "category": "CONSTRUCT", "required_skills": [ [ "fabrication", 4 ], [ "electronics", 3 ] ], diff --git a/data/mods/Magiclysm/recipes/construction.json b/data/mods/Magiclysm/recipes/construction.json index 6ad3032e5dce7..e089b1564c5a9 100644 --- a/data/mods/Magiclysm/recipes/construction.json +++ b/data/mods/Magiclysm/recipes/construction.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_magiclysm_translocator_gate", "description": "Build Translocator Gate", "category": "FURN", "required_skills": [ [ "fabrication", 6 ], [ "spellcraft", 6 ] ], diff --git a/data/mods/blazemod/blaze_blob_construct.json b/data/mods/blazemod/blaze_blob_construct.json index 2f6f4d69d25bd..741f0b79b4128 100644 --- a/data/mods/blazemod/blaze_blob_construct.json +++ b/data/mods/blazemod/blaze_blob_construct.json @@ -1,6 +1,7 @@ [ { "type": "construction", + "id": "constr_blaze_blob_pit", "category": "OTHER", "description": "Harvest Blob Feed from Corpse Pit: Smash to Harvest", "difficulty": 0, @@ -13,6 +14,7 @@ }, { "type": "construction", + "id": "constr_blaze_blob_pit_slime", "category": "OTHER", "description": "Harvest Blob Feed from Slime: Smash to Harvest", "difficulty": 0, diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 566dd08d0a9e6..b6c8df5664cbd 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -3320,7 +3320,6 @@ void activity_handlers::churn_finish( player_activity *act, player *p ) void activity_handlers::build_do_turn( player_activity *act, player *p ) { - const std::vector &list_constructions = get_constructions(); partial_con *pc = g->m.partial_con_at( g->m.getlocal( act->placement ) ); // Maybe the player and the NPC are working on the same construction at the same time if( !pc ) { @@ -3336,7 +3335,7 @@ void activity_handlers::build_do_turn( player_activity *act, player *p ) return; } // if you ( or NPC ) are finishing someone elses started construction... - const construction &built = list_constructions[pc->id]; + const construction &built = pc->id.obj(); if( !p->meets_skill_requirements( built ) ) { add_msg( m_info, _( "%s can't work on this construction anymore." ), p->disp_name() ); p->cancel_activity(); diff --git a/src/activity_handlers.h b/src/activity_handlers.h index 7dc75f5f06cea..834ac0e3b9233 100644 --- a/src/activity_handlers.h +++ b/src/activity_handlers.h @@ -61,10 +61,10 @@ struct activity_reason_info { //is it possible to do this bool can_do; //construction index - cata::optional con_idx; + cata::optional con_idx; activity_reason_info( do_activity_reason reason_, bool can_do_, - cata::optional con_idx_ = cata::optional() ) : + const cata::optional &con_idx_ = cata::nullopt ) : reason( reason_ ), can_do( can_do_ ), con_idx( con_idx_ ) @@ -75,7 +75,7 @@ struct activity_reason_info { } static activity_reason_info build( const do_activity_reason &reason_, bool can_do_, - size_t con_idx_ ) { + const construction_id &con_idx_ ) { return activity_reason_info( reason_, can_do_, con_idx_ ); } diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 6f423258032e1..840b8a65ebdb6 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -1024,11 +1024,11 @@ static activity_reason_info find_base_construction( player &p, const inventory &inv, const tripoint &loc, - const cata::optional &part_con_idx, - const size_t idx, - std::set &used ) + const cata::optional &part_con_idx, + const construction_id idx, + std::set &used ) { - const construction &build = list_constructions[idx]; + const construction &build = idx.obj(); //already done? const furn_id furn = g->m.furn( loc ); const ter_id ter = g->m.ter( loc ); @@ -1088,7 +1088,7 @@ static activity_reason_info find_base_construction( //we can't immediately build it, looking for pre-req used.insert( idx ); cata::optional reason; - size_t pre_req_idx = 0; + construction_id pre_req_idx( -1 ); //first step: try only constructions with the same description //second step: try all constructions for( int try_num = 0; try_num < 2; ++try_num ) { @@ -1487,7 +1487,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe zones = mgr.get_zones( zone_type_CONSTRUCTION_BLUEPRINT, g->m.getabs( src_loc ) ); const partial_con *part_con = g->m.partial_con_at( src_loc ); - cata::optional part_con_idx; + cata::optional part_con_idx; if( part_con ) { part_con_idx = part_con->id; } @@ -1497,13 +1497,13 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe const inventory pre_inv = p.crafting_inventory( src_loc, PICKUP_RANGE - 1 ); for( const zone_data &zone : zones ) { const blueprint_options options = dynamic_cast( zone.get_options() ); - const int index = options.get_index(); + const construction_id index = options.get_index(); if( !stuff_there.empty() ) { - return activity_reason_info::build( BLOCKING_TILE, false, static_cast( index ) ); + return activity_reason_info::build( BLOCKING_TILE, false, index ); } - std::set used_idx; + std::set used_idx; const activity_reason_info act_info = find_base_construction( list_constructions, p, pre_inv, - src_loc, part_con_idx, static_cast( index ), used_idx ); + src_loc, part_con_idx, index, used_idx ); return act_info; } } else if( act == ACT_MULTIPLE_FARM ) { @@ -1846,7 +1846,7 @@ static std::vector> requirements_map( player } static void construction_activity( player &p, const zone_data *zone, const tripoint &src_loc, - const activity_reason_info &act_info, const std::vector &list_constructions, + const activity_reason_info &act_info, activity_id activity_to_restore ) { const blueprint_options options = dynamic_cast( zone->get_options() ); @@ -1855,7 +1855,7 @@ static void construction_activity( player &p, const zone_data *zone, const tripo debugmsg( "no construction selected" ); return; } - const construction &built_chosen = list_constructions[*act_info.con_idx]; + const construction &built_chosen = act_info.con_idx->obj(); std::list used; // create the partial construction struct partial_con pc; @@ -2512,7 +2512,6 @@ static bool generic_multi_activity_check_requirement( player &p, const activity_ { const tripoint abspos = g->m.getabs( p.pos() ); zone_manager &mgr = zone_manager::get_manager(); - const std::vector &list_constructions = get_constructions(); bool &can_do_it = act_info.can_do; const do_activity_reason &reason = act_info.reason; @@ -2573,7 +2572,7 @@ static bool generic_multi_activity_check_requirement( player &p, const activity_ return true; } // its a construction and we need the components. - const construction &built_chosen = list_constructions[ *act_info.con_idx ]; + const construction &built_chosen = act_info.con_idx->obj(); what_we_need = built_chosen.requirements; } else if( reason == NEEDS_VEH_DECONST || reason == NEEDS_VEH_REPAIR ) { const vehicle *veh = veh_pointer_or_null( g->m.veh_at( src_loc ) ); @@ -2681,7 +2680,6 @@ static bool generic_multi_activity_do( player &p, const activity_id &act_id, const tripoint &src, const tripoint &src_loc ) { zone_manager &mgr = zone_manager::get_manager(); - const std::vector &list_constructions = get_constructions(); const do_activity_reason &reason = act_info.reason; const zone_data *zone = mgr.get_zone_at( src, get_zone_for_act( src_loc, mgr, act_id ) ); @@ -2729,7 +2727,7 @@ static bool generic_multi_activity_do( player &p, const activity_id &act_id, p.activity.placement = src; return false; } - construction_activity( p, zone, src_loc, act_info, list_constructions, act_id ); + construction_activity( p, zone, src_loc, act_info, act_id ); return false; } else if( reason == CAN_DO_FETCH && act_id == ACT_TIDY_UP ) { if( !tidy_activity( p, src_loc, act_id, ACTIVITY_SEARCH_DISTANCE ) ) { diff --git a/src/clzones.cpp b/src/clzones.cpp index a339d6189d80b..8355b4be7b6f8 100644 --- a/src/clzones.cpp +++ b/src/clzones.cpp @@ -163,26 +163,26 @@ bool zone_options::is_valid( const zone_type_id &type, const zone_options &optio return !options.has_options(); } -int blueprint_options::get_final_construction( +construction_id blueprint_options::get_final_construction( const std::vector &list_constructions, - int idx, - std::set &skip_index + const construction_id &idx, + std::set &skip_index ) { - const construction &con = list_constructions[idx]; + const construction &con = idx.obj(); if( con.post_terrain.empty() ) { return idx; } for( int i = 0; i < static_cast( list_constructions.size() ); ++i ) { - if( i == idx || skip_index.find( i ) != skip_index.end() ) { + if( construction_id( i ) == idx || skip_index.find( construction_id( i ) ) != skip_index.end() ) { continue; } const construction &con_next = list_constructions[i]; if( con.description == con_next.description && con.post_terrain == con_next.pre_terrain ) { skip_index.insert( idx ); - return get_final_construction( list_constructions, i, skip_index ); + return get_final_construction( list_constructions, construction_id( i ), skip_index ); } } @@ -191,13 +191,13 @@ int blueprint_options::get_final_construction( blueprint_options::query_con_result blueprint_options::query_con() { - int con_index = construction_menu( true ); - if( con_index > -1 ) { + construction_id con_index = construction_menu( true ); + if( con_index.is_valid() ) { const std::vector &list_constructions = get_constructions(); - std::set skip_index; + std::set skip_index; con_index = get_final_construction( list_constructions, con_index, skip_index ); - const construction &chosen = list_constructions[con_index]; + const construction &chosen = con_index.obj(); const std::string &chosen_desc = chosen.description; const std::string &chosen_mark = chosen.post_terrain; @@ -384,14 +384,19 @@ void blueprint_options::serialize( JsonOut &json ) const { json.member( "mark", mark ); json.member( "con", con ); - json.member( "index", index ); + json.member( "index", index.id() ); } void blueprint_options::deserialize( const JsonObject &jo_zone ) { jo_zone.read( "mark", mark ); jo_zone.read( "con", con ); - jo_zone.read( "index", index ); + if( jo_zone.has_int( "index" ) ) { + // Oops, saved incorrectly as an int id by legacy code. Just load it and hope for the best + index = construction_id( jo_zone.get_int( "index" ) ); + } else { + index = construction_str_id( jo_zone.get_string( "index" ) ).id(); + } } void plot_options::serialize( JsonOut &json ) const diff --git a/src/clzones.h b/src/clzones.h index de0f646828510..27c89c88a5504 100644 --- a/src/clzones.h +++ b/src/clzones.h @@ -151,7 +151,7 @@ class blueprint_options : public zone_options, public mark_option // furn/ter id as string. std::string mark; std::string con; - int index; + construction_id index; enum query_con_result { canceled, @@ -168,7 +168,7 @@ class blueprint_options : public zone_options, public mark_option std::string get_con() const { return con; } - int get_index() const { + construction_id get_index() const { return index; } @@ -176,10 +176,10 @@ class blueprint_options : public zone_options, public mark_option return true; } - int get_final_construction( + construction_id get_final_construction( const std::vector &list_constructions, - int idx, - std::set &skip_index ); + const construction_id &idx, + std::set &skip_index ); bool query_at_creation() override; bool query() override; diff --git a/src/construction.cpp b/src/construction.cpp index f81b7577f7852..7683ef9a50dad 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -56,6 +56,8 @@ class inventory; +static bool finalized = false; + // Construction functions. namespace construct { @@ -92,7 +94,8 @@ void failure_standard( const tripoint & ); void failure_deconstruct( const tripoint & ); } // namespace construct -std::vector constructions; +static std::vector constructions; +static std::map construction_id_map; // Helper functions, nobody but us needs to call these. static bool can_construct( const std::string &desc ); @@ -131,6 +134,10 @@ static bool has_pre_terrain( const construction &con ) void standardize_construction_times( const int time ) { + if( !finalized ) { + debugmsg( "standardize_construction_times called before finalization" ); + return; + } for( auto &c : constructions ) { c.time = time; } @@ -138,6 +145,10 @@ void standardize_construction_times( const int time ) static std::vector constructions_by_desc( const std::string &description ) { + if( !finalized ) { + debugmsg( "constructions_by_desc called before finalization" ); + return {}; + } std::vector result; for( auto &constructions_a : constructions ) { if( constructions_a.description == description ) { @@ -153,6 +164,10 @@ static void load_available_constructions( std::vector &available, { cat_available.clear(); available.clear(); + if( !finalized ) { + debugmsg( "load_available_constructions called before finalization" ); + return; + } for( auto &it : constructions ) { if( it.on_display && ( !hide_unconstructable || can_construct( it ) ) ) { bool already_have_it = false; @@ -218,11 +233,20 @@ static nc_color construction_color( const std::string &con_name, bool highlight const std::vector &get_constructions() { + if( !finalized ) { + debugmsg( "get_constructions called before finalization" ); + static std::vector fake_constructions; + return fake_constructions; + } return constructions; } -int construction_menu( bool blueprint ) +construction_id construction_menu( const bool blueprint ) { + if( !finalized ) { + debugmsg( "construction_menu called before finalization" ); + return construction_id( -1 ); + } static bool hide_unconstructable = false; // only display constructions the player can theoretically perform std::vector available; @@ -231,7 +255,7 @@ int construction_menu( bool blueprint ) if( available.empty() ) { popup( _( "You can not construct anything here." ) ); - return -1; + return construction_id( -1 ); } int w_height = TERMY; @@ -255,7 +279,7 @@ int construction_menu( bool blueprint ) draw_grid( w_con, w_list_width + w_list_x0 ); - int ret = -1; + construction_id ret( -1 ); std::vector construct_cat; construct_cat = construction_categories::get_all(); @@ -672,7 +696,7 @@ int construction_menu( bool blueprint ) const std::vector &list_constructions = get_constructions(); for( int i = 0; i < static_cast( list_constructions.size() ); ++i ) { if( constructs[select] == list_constructions[i].description ) { - ret = i; + ret = construction_id( i ); break; } } @@ -827,6 +851,10 @@ void place_construction( const std::string &desc ) void complete_construction( player *p ) { + if( !finalized ) { + debugmsg( "complete_construction called before finalization" ); + return; + } const tripoint terp = g->m.getlocal( p->activity.placement ); partial_con *pc = g->m.partial_con_at( terp ); if( !pc ) { @@ -842,7 +870,7 @@ void complete_construction( player *p ) } return; } - const construction &built = constructions[pc->id]; + const construction &built = pc->id.obj(); const auto award_xp = [&]( player & c ) { for( const auto &pr : built.required_skills ) { c.practice( pr.first, static_cast( ( 10 + 15 * pr.second ) * ( 1 + built.time / 180000.0 ) ), @@ -1306,7 +1334,15 @@ void assign_or_debugmsg( T &dest, const std::string &fun_id, void load_construction( const JsonObject &jo ) { construction con; - con.id = constructions.size(); + // These ids are only temporary. The actual ids are determined in finalize_construction, + // after removing blacklisted constructions. + con.id = construction_id( -1 ); + con.str_id = construction_str_id( jo.get_string( "id" ) ); + if( con.str_id.is_null() ) { + jo.throw_error( "Null construction id specified", "id" ); + } else if( construction_id_map.find( con.str_id ) != construction_id_map.end() ) { + jo.throw_error( "Duplicate construction id", "id" ); + } con.description = jo.get_string( "description" ); if( jo.has_member( "required_skills" ) ) { @@ -1327,8 +1363,7 @@ void load_construction( const JsonObject &jo ) time_duration::units ) ); } - // Warning: the IDs may change! - const requirement_id req_id( string_format( "inline_construction_%u", con.id ) ); + const requirement_id req_id( "inline_construction_" + con.str_id.str() ); requirement_data::load_requirement( jo, req_id ); con.requirements = req_id; @@ -1411,11 +1446,14 @@ void load_construction( const JsonObject &jo ) con.on_display = jo.get_bool( "on_display", true ); constructions.push_back( con ); + construction_id_map.emplace( con.str_id, con.id ); } void reset_constructions() { constructions.clear(); + construction_id_map.clear(); + finalized = false; } void check_constructions() @@ -1454,9 +1492,16 @@ void check_constructions() debugmsg( "Unknown post_terrain (terrain) %s in %s", c.post_terrain, display_name ); } } - if( c.id != i ) { + if( c.id != construction_id( i ) ) { debugmsg( "Construction \"%s\" has id %u, but should have %u", - c.description, c.id, i ); + c.description, c.id.to_i(), i ); + } + if( construction_id_map.find( c.str_id ) == construction_id_map.end() ) { + debugmsg( "Construction \"%s\" has invalid string id %s", + c.description, c.str_id.str() ); + } else if( construction_id_map[c.str_id] != construction_id( i ) ) { + debugmsg( "Construction \"%s\" has string id \"%s\" that points to int id %u, but should point to %u", + c.description, c.str_id.str(), construction_id_map[c.str_id].to_i(), i ); } } } @@ -1558,16 +1603,24 @@ void finalize_constructions() return c.requirements->is_blacklisted(); } ), constructions.end() ); + construction_id_map.clear(); for( size_t i = 0; i < constructions.size(); i++ ) { - constructions[ i ].id = i; + constructions[ i ].id = construction_id( i ); + construction_id_map.emplace( constructions[i].str_id, constructions[i].id ); } + + finalized = true; } void get_build_reqs_for_furn_ter_ids( const std::pair, std::map> &changed_ids, build_reqs &total_reqs ) { - std::map total_builds; + if( !finalized ) { + debugmsg( "get_build_reqs_for_furn_ter_ids called before finalization" ); + return; + } + std::map total_builds; // iteratively recurse through the pre-terrains until the pre-terrain is empty, adding // the constructions to the total_builds map @@ -1624,7 +1677,7 @@ void get_build_reqs_for_furn_ter_ids( const std::pair, } for( const auto &build_data : total_builds ) { - const construction &build = constructions[build_data.first]; + const construction &build = build_data.first.obj(); const int count = build_data.second; total_reqs.time += build.time * count; if( total_reqs.reqs.find( build.requirements ) == total_reqs.reqs.end() ) { @@ -1640,3 +1693,89 @@ void get_build_reqs_for_furn_ter_ids( const std::pair, } } } + +static const construction null_construction {}; + +template <> +const construction_str_id &construction_id::id() const +{ + if( !finalized ) { + debugmsg( "construction_id::id called before finalization" ); + return construction_str_id::NULL_ID(); + } else if( is_valid() ) { + return constructions[to_i()].str_id; + } else { + if( to_i() != -1 ) { + debugmsg( "Invalid construction id %d", to_i() ); + } + return construction_str_id::NULL_ID(); + } +} + +template <> +const construction &construction_id::obj() const +{ + if( !finalized ) { + debugmsg( "construction_id::obj called before finalization" ); + return null_construction; + } else if( is_valid() ) { + return constructions[to_i()]; + } else { + debugmsg( "Invalid construction id %d", to_i() ); + return null_construction; + } +} + +template <> +bool construction_id::is_valid() const +{ + if( !finalized ) { + debugmsg( "construction_id::is_valid called before finalization" ); + return false; + } + return to_i() >= 0 && static_cast( to_i() ) < constructions.size(); +} + +template <> +construction_id construction_str_id::id() const +{ + if( !finalized ) { + debugmsg( "construction_str_id::id called before finalization" ); + return construction_id( -1 ); + } + auto it = construction_id_map.find( *this ); + if( it != construction_id_map.end() ) { + return it->second; + } else { + if( !is_null() ) { + debugmsg( "Invalid construction str id %s", str() ); + } + return construction_id( -1 ); + } +} + +template <> +const construction &construction_str_id::obj() const +{ + if( !finalized ) { + debugmsg( "construction_str_id::obj called before finalization" ); + return null_construction; + } + auto it = construction_id_map.find( *this ); + if( it != construction_id_map.end() ) { + return it->second.obj(); + } else { + debugmsg( "Invalid construction str id %s", str() ); + return null_construction; + } +} + +template <> +bool construction_str_id::is_valid() const +{ + if( !finalized ) { + debugmsg( "construction_str_id::is_valid called before finalization" ); + return false; + } + return construction_id_map.find( *this ) != construction_id_map.end(); +} diff --git a/src/construction.h b/src/construction.h index 879525249f9a8..c9d2767bc5714 100644 --- a/src/construction.h +++ b/src/construction.h @@ -11,6 +11,7 @@ #include #include +#include "int_id.h" #include "item.h" #include "optional.h" #include "string_id.h" @@ -30,7 +31,7 @@ struct tripoint; struct partial_con { int counter = 0; std::list components = {}; - size_t id = 0; + construction_id id = construction_id( -1 ); }; struct build_reqs { @@ -39,6 +40,11 @@ struct build_reqs { int time = 0; }; +template <> +const construction &construction_id::obj() const; +template <> +bool construction_id::is_valid() const; + struct construction { // Construction type category construction_category_id category; @@ -67,7 +73,8 @@ struct construction { requirement_id requirements; // Index in construction vector - size_t id; + construction_id id = construction_id( -1 ); + construction_str_id str_id = construction_str_id::NULL_ID(); // Time in moves int time; @@ -106,7 +113,7 @@ void standardize_construction_times( int time ); void load_construction( const JsonObject &jo ); void reset_constructions(); -int construction_menu( bool blueprint ); +construction_id construction_menu( bool blueprint ); void complete_construction( player *p ); bool can_construct( const construction &con, const tripoint &p ); bool player_can_build( player &p, const inventory &inv, const construction &con ); diff --git a/src/game.cpp b/src/game.cpp index 8c48b3aecbcdb..a1929dcb07f37 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5811,8 +5811,7 @@ void game::print_trap_info( const tripoint &lp, const catacurses::window &w_look partial_con *pc = g->m.partial_con_at( lp ); std::string tr_name; if( pc && tr.loadid == tr_unfinished_construction ) { - const std::vector &list_constructions = get_constructions(); - const construction &built = list_constructions[pc->id]; + const construction &built = pc->id.obj(); tr_name = string_format( _( "Unfinished task: %s, %d%% complete" ), built.description, pc->counter / 100000 ); } else { diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 35dc578b5e460..da22a49af18fe 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -3572,8 +3572,7 @@ void iexamine::trap( player &p, const tripoint &examp ) add_msg( m_info, _( "It is too dark to construct right now." ) ); return; } - const std::vector &list_constructions = get_constructions(); - const construction &built = list_constructions[pc->id]; + const construction &built = pc->id.obj(); if( !query_yn( _( "Unfinished task: %s, %d%% complete here, continue construction?" ), built.description, pc->counter / 100000 ) ) { if( query_yn( _( "Cancel construction?" ) ) ) { diff --git a/src/init.cpp b/src/init.cpp index c74218b217372..b2317e8464540 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -591,10 +591,10 @@ void DynamicDataLoader::finalize_loaded_data( loading_ui &ui ) { _( "Monster groups" ), &MonsterGroupManager::FinalizeMonsterGroups }, { _( "Monster factions" ), &monfactions::finalize }, { _( "Factions" ), &npc_factions::finalize }, + { _( "Constructions" ), &finalize_constructions }, { _( "Crafting recipes" ), &recipe_dictionary::finalize }, { _( "Recipe groups" ), &recipe_group::check }, { _( "Martial arts" ), &finialize_martial_arts }, - { _( "Constructions" ), &finalize_constructions }, { _( "NPC classes" ), &npc_class::finalize_all }, { _( "Missions" ), &mission_type::finalize }, { _( "Behaviors" ), &behavior::finalize }, diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 43572a2f0a278..9e39e915808e7 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -3745,7 +3745,7 @@ void submap::store( JsonOut &jsout ) const jsout.write( elem.first.y ); jsout.write( elem.first.z ); jsout.write( elem.second.counter ); - jsout.write( elem.second.id ); + jsout.write( elem.second.id.id() ); jsout.start_array(); for( auto &it : elem.second.components ) { jsout.write( it ); @@ -4016,7 +4016,12 @@ void submap::load( JsonIn &jsin, const std::string &member_name, int version ) int k = jsin.get_int(); tripoint pt = tripoint( i, j, k ); pc.counter = jsin.get_int(); - pc.id = jsin.get_int(); + if( jsin.test_int() ) { + // Oops, int id incorrectly saved by legacy code, just load it and hope for the best + pc.id = construction_id( jsin.get_int() ); + } else { + pc.id = construction_str_id( jsin.get_string() ).id(); + } jsin.start_array(); while( !jsin.end_array() ) { item tmp; diff --git a/src/string_id_null_ids.cpp b/src/string_id_null_ids.cpp index d3bb21e2d3b27..751b1c9ddb3e7 100644 --- a/src/string_id_null_ids.cpp +++ b/src/string_id_null_ids.cpp @@ -54,3 +54,4 @@ MAKE_NULL_ID2( mutation_branch, "" ) MAKE_NULL_ID2( requirement_data, "null" ) MAKE_NULL_ID2( body_part_struct, "NUM_BP" ) MAKE_NULL_ID2( bionic_data, "" ) +MAKE_NULL_ID2( construction, "constr_null", -1 ) diff --git a/src/type_id.h b/src/type_id.h index 27ebf5f227334..d3246ae43dc3c 100644 --- a/src/type_id.h +++ b/src/type_id.h @@ -156,4 +156,8 @@ using zone_type_id = string_id; class translation; using snippet_id = string_id; +struct construction; +using construction_id = int_id; +using construction_str_id = string_id; + #endif // TYPE_ID_H From 5029803d70046ccb3d76aa7f1c47054f51adef7b Mon Sep 17 00:00:00 2001 From: Qrox Date: Mon, 27 Jan 2020 18:39:56 +0800 Subject: [PATCH 2/3] Correctly hide unavailable constructions --- src/construction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/construction.cpp b/src/construction.cpp index 7683ef9a50dad..9cba1cf838c2b 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -169,7 +169,8 @@ static void load_available_constructions( std::vector &available, return; } for( auto &it : constructions ) { - if( it.on_display && ( !hide_unconstructable || can_construct( it ) ) ) { + if( it.on_display && ( !hide_unconstructable || + ( can_construct( it ) && player_can_build( g->u, g->u.crafting_inventory(), it ) ) ) ) { bool already_have_it = false; for( auto &avail_it : available ) { if( avail_it == it.description ) { From fff89e770189aac0f8e87ddde8d3795525c64277 Mon Sep 17 00:00:00 2001 From: Qrox Date: Mon, 27 Jan 2020 19:53:10 +0800 Subject: [PATCH 3/3] Ignore skill requirements with debug hammerspace --- src/activity_handlers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index b6c8df5664cbd..c970c81e8989d 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -3336,7 +3336,7 @@ void activity_handlers::build_do_turn( player_activity *act, player *p ) } // if you ( or NPC ) are finishing someone elses started construction... const construction &built = pc->id.obj(); - if( !p->meets_skill_requirements( built ) ) { + if( !p->has_trait( trait_DEBUG_HS ) && !p->meets_skill_requirements( built ) ) { add_msg( m_info, _( "%s can't work on this construction anymore." ), p->disp_name() ); p->cancel_activity(); if( p->is_npc() ) {