Skip to content

Commit

Permalink
Small scale anaerobic digestion system (#72987)
Browse files Browse the repository at this point in the history
* Add anaerobic digester, organic_waste requirement,
biogas, biogas tank and cooker, and relevant recipes.

* Borrowed and modified fermenting vat functions.
Get biogas and fermented liquid from anaerobic digester.

* Modified the density of dungs.
Add water_sewage to organic_waste.

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Revert the modification of the density of dungs.

* Add new words biogas/biogases
to tools/spell_checker/dictionary.txt.

* Change the recipe of the digester to make it more
resonable.

* Fix biogas tank.

* Clang-tidy

* Add crafting_pseudo_item fake_digester_tank to
anaerobic digester, and use it in the recipes of
fermentable_liquid_mixture.
Add CONTAIN level 1 to the requirement of simple
liquid fertilizer recipe.

* Clang-tidy

* Update src/iexamine.cpp

Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
  • Loading branch information
3 people authored Apr 18, 2024
1 parent 6dcf0b2 commit 326e9b2
Show file tree
Hide file tree
Showing 24 changed files with 749 additions and 10 deletions.
21 changes: 21 additions & 0 deletions data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -2523,6 +2523,27 @@
"pre_special": "check_empty",
"post_terrain": "f_fvat_wood_empty"
},
{
"type": "construction",
"id": "constr_compost_empty",
"group": "build_compost_tank",
"category": "FURN",
"required_skills": [ [ "fabrication", 5 ], [ "mechanics", 2 ] ],
"time": "2880 m",
"qualities": [ [ { "id": "HAMMER", "level": 2 } ], [ { "id": "SAW_M", "level": 1 } ], [ { "id": "SMOOTH", "level": 1 } ] ],
"using": [ [ "welding_standard", 10 ] ],
"components": [
[ [ "brick", 600 ] ],
[ [ "pipe", 8 ] ],
[ [ "pipe_fittings", 8 ] ],
[ [ "metal_tank", 1 ] ],
[ [ "hose", 2 ], [ "makeshift_hose", 2 ] ],
[ [ "mortar_build", 10 ], [ "mortar_lime", 10 ] ],
[ [ "water", 80 ], [ "water_clean", 80 ] ]
],
"pre_terrain": "t_pit",
"post_terrain": "f_compost_empty"
},
{
"type": "construction",
"id": "constr_wood_keg",
Expand Down
5 changes: 5 additions & 0 deletions data/json/construction_group.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@
"id": "build_wooden_fermenting_vat",
"name": "Build Wooden Fermenting Vat"
},
{
"type": "construction_group",
"id": "build_compost_tank",
"name": "Build Small Scale Anaerobic Digestion System"
},
{
"type": "construction_group",
"id": "build_fire_ring",
Expand Down
62 changes: 62 additions & 0 deletions data/json/furniture_and_terrain/furniture-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,68 @@
]
}
},
{
"type": "furniture",
"id": "f_compost_empty",
"name": "anaerobic digester",
"looks_like": "f_standing_tank",
"description": "A 1000 L anaerobic digester.",
"symbol": "O",
"color": "brown",
"move_cost_mod": -1,
"required_str": -1,
"flags": [ "NOITEM", "SEALED", "TRANSPARENT", "FLAMMABLE", "CONTAINER", "DONT_REMOVE_ROTTEN" ],
"examine_action": "compost_empty",
"crafting_pseudo_item": "fake_digester_tank",
"deconstruct": {
"items": [
{ "item": "brick", "count": 60 },
{ "item": "pipe", "count": [ 6, 8 ] },
{ "item": "pipe_fittings", "count": [ 6, 8 ] },
{ "item": "sheet_metal_small", "count": [ 10, 20 ] },
{ "item": "metal_tank", "count": 1 },
{ "item": "hose", "count": 1 }
]
},
"bash": {
"str_min": 3,
"str_max": 45,
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "scrap", "count": [ 8, 32 ] } ]
}
},
{
"type": "furniture",
"id": "f_compost_full",
"name": "filled anaerobic digester",
"looks_like": "f_standing_tank",
"description": "A 1000L anaerobic digester.",
"symbol": "O",
"color": "brown_cyan",
"move_cost_mod": -1,
"required_str": -1,
"flags": [ "NOITEM", "SEALED", "TRANSPARENT", "FLAMMABLE", "CONTAINER", "DONT_REMOVE_ROTTEN" ],
"examine_action": "compost_full",
"crafting_pseudo_item": "fake_digester_tank",
"deconstruct": {
"items": [
{ "item": "brick", "count": 60 },
{ "item": "pipe", "count": [ 6, 8 ] },
{ "item": "pipe_fittings", "count": [ 6, 8 ] },
{ "item": "sheet_metal_small", "count": [ 10, 20 ] },
{ "item": "metal_tank", "count": 1 },
{ "item": "hose", "count": 1 }
]
},
"bash": {
"str_min": 12,
"str_max": 50,
"sound": "smash!",
"sound_fail": "whump.",
"items": [ { "item": "scrap", "count": [ 8, 32 ] } ]
}
},
{
"type": "furniture",
"id": "f_butcher_rack",
Expand Down
6 changes: 6 additions & 0 deletions data/json/items/ammo_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,12 @@
"name": "propane",
"default": "propane"
},
{
"type": "ammunition_type",
"id": "biogas",
"name": "biogas",
"default": "biogas"
},
{
"type": "ammunition_type",
"id": "conc_alcohol",
Expand Down
7 changes: 7 additions & 0 deletions data/json/items/basecamp.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,12 @@
"copy-from": "fake_item",
"name": { "str": "basecamp parkour gym" },
"description": "A fake parkour gym used for parkour training in basecamps."
},
{
"id": "fake_digester_tank",
"type": "TOOL",
"copy-from": "fake_item",
"name": { "str": "small anaerobic digester tank" },
"description": "A fake tank for mixing biomass and water."
}
]
27 changes: 27 additions & 0 deletions data/json/items/chemicals_and_resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,33 @@
"category": "chems",
"fun": -30
},
{
"type": "COMESTIBLE",
"id": "fermentable_liquid_mixture",
"name": { "str_sp": "fermentable liquid mixture" },
"volume": "500 ml",
"weight": "500 g",
"description": "A mixture of various organic wastes and water. Wait about two months for them to be fermented in a tank.",
"copy-from": "fertilizer_liquid",
"price": 0,
"price_postapoc": 0,
"flags": [ "NUTRIENT_OVERRIDE", "TRADER_AVOID" ],
"compostable": { "time": "60 days", "results": [ "fermented_fertilizer_liquid", "biogas" ] },
"charges": 1
},
{
"type": "COMESTIBLE",
"id": "fermented_fertilizer_liquid",
"name": { "str_sp": "fermented fertilizer liquid" },
"volume": "500 ml",
"weight": "400 g",
"description": "A mixture of fermented biomass, will become liquid fertilizer after simple treatment.",
"copy-from": "fertilizer_liquid",
"price": 0,
"price_postapoc": 0,
"flags": [ "NUTRIENT_OVERRIDE", "TRADER_AVOID" ],
"charges": 1
},
{
"type": "COMESTIBLE",
"id": "fertilizer_commercial",
Expand Down
72 changes: 72 additions & 0 deletions data/json/items/containers/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -4339,6 +4339,78 @@
"flags": [ "GAS_TANK", "COLLAPSE_CONTENTS", "NO_SALVAGE" ],
"melee_damage": { "bash": 10 }
},
{
"id": "small_biogas_tank",
"type": "TOOL",
"category": "container",
"name": { "str": "small biogas tank" },
"description": "A small tank of biogas, commonly used for camping stoves and torches.",
"copy-from": "small_propane_tank",
"pocket_data": [
{
"pocket_type": "CONTAINER",
"airtight": true,
"rigid": true,
"max_contains_volume": "5 L",
"max_contains_weight": "1 kg",
"item_restriction": [ "biogas" ]
}
]
},
{
"id": "medium_biogas_tank",
"type": "TOOL",
"category": "container",
"name": { "str": "medium biogas tank" },
"description": "A medium-sized tank of biogas, commonly used for barbeques.",
"copy-from": "medium_propane_tank",
"pocket_data": [
{
"pocket_type": "CONTAINER",
"airtight": true,
"rigid": true,
"max_contains_volume": "20 L",
"max_contains_weight": "10 kg",
"item_restriction": [ "biogas" ]
}
]
},
{
"id": "large_biogas_tank",
"type": "TOOL",
"category": "container",
"name": { "str": "large biogas tank" },
"description": "A large tank of biogas, commonly used for heating.",
"copy-from": "large_propane_tank",
"pocket_data": [
{
"pocket_type": "CONTAINER",
"airtight": true,
"rigid": true,
"max_contains_volume": "75 L",
"max_contains_weight": "25 kg",
"item_restriction": [ "biogas" ]
}
]
},
{
"id": "xl_biogas_tank",
"type": "TOOL",
"category": "container",
"name": { "str": "extra large biogas tank" },
"description": "A massive tank of biogas, commonly used for heating a home or vehicle.",
"copy-from": "xl_propane_tank",
"pocket_data": [
{
"pocket_type": "CONTAINER",
"airtight": true,
"rigid": true,
"max_contains_volume": "350 L",
"max_contains_weight": "50 kg",
"item_restriction": [ "biogas" ]
}
]
},
{
"id": "shot_glass",
"type": "GENERIC",
Expand Down
12 changes: 12 additions & 0 deletions data/json/items/fuel.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@
"color": "white",
"ammo_type": "propane"
},
{
"id": "biogas",
"type": "AMMO",
"name": { "str_sp": "biogas" },
"copy-from": "propane",
"description": "Biogas gathered from anaerobic digester system, can be used in biogas cooker.",
"price": 0,
"price_postapoc": 0,
"container": "small_biogas_tank",
"material": [ "hydrocarbons" ],
"ammo_type": "biogas"
},
{
"id": "chem_turpentine",
"type": "AMMO",
Expand Down
19 changes: 19 additions & 0 deletions data/json/items/tool/cooking.json
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,25 @@
"flags": [ "FIRESTARTER" ],
"melee_damage": { "bash": 4 }
},
{
"id": "biogas_cooker",
"type": "TOOL",
"name": { "str": "biogas cooker" },
"description": "A simple heater powered by biogas. It is designed for cooking food.",
"copy-from": "propane_cooker",
"ammo": [ "biogas" ],
"pocket_data": [
{
"pocket_type": "MAGAZINE",
"airtight": true,
"watertight": true,
"rigid": true,
"ammo_restriction": { "biogas": 3000 }
}
],
"charges_per_use": 8,
"use_action": [ "HOTPLATE", "HEAT_FOOD", { "type": "firestarter", "moves": 100, "moves_slow": 1000 } ]
},
{
"id": "acetylene_cooker",
"type": "TOOL",
Expand Down
47 changes: 39 additions & 8 deletions data/json/recipes/recipe_medsandchemicals.json
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,41 @@
"tools": [ [ [ "surface_heat", 2, "LIST" ] ] ],
"components": [ [ [ "bag_plastic", 1 ], [ "heatpack_used", 1 ] ], [ [ "oxy_powder", 5 ] ], [ [ "scrap", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "fermentable_liquid_mixture",
"category": "CC_CHEM",
"subcategory": "CSC_CHEM_CHEMICALS",
"skill_used": "survival",
"difficulty": 2,
"time": "2 m",
"charges": 3,
"autolearn": true,
"batch_time_factors": [ 90, 4 ],
"flags": [ "BLIND_EASY", "ALLOW_ROTTEN" ],
"tools": [ [ "fake_digester_tank" ] ],
"components": [ [ [ "water", 3 ], [ "water_clean", 3 ] ] ],
"using": [ [ "organic_waste", 1 ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "fermentable_liquid_mixture",
"id_suffix": "hard",
"category": "CC_CHEM",
"subcategory": "CSC_CHEM_CHEMICALS",
"skill_used": "survival",
"difficulty": 2,
"time": "30 m",
"charges": 5,
"autolearn": true,
"proficiencies": [ { "proficiency": "prof_intro_chemistry" } ],
"batch_time_factors": [ 70, 4 ],
"flags": [ "BLIND_HARD", "ALLOW_ROTTEN" ],
"tools": [ [ "fake_digester_tank" ] ],
"components": [ [ [ "ruined_chunks", 20 ] ], [ [ "water", 5 ], [ "water_clean", 5 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
Expand All @@ -830,19 +865,15 @@
"skill_used": "survival",
"difficulty": 2,
"time": "20 m",
"charges": 5,
"autolearn": true,
"//": "Too simple. Just mixing feces and chitin with water. Basic chemistry shall be enough for this.",
"//": "Simply heating fermented fertilizer liquid.",
"proficiencies": [ { "proficiency": "prof_intro_chemistry" } ],
"batch_time_factors": [ 80, 4 ],
"flags": [ "BLIND_HARD", "ALLOW_ROTTEN" ],
"qualities": [ { "id": "BOIL", "level": 1 } ],
"qualities": [ { "id": "CONTAIN", "level": 1 }, { "id": "BOIL", "level": 1 } ],
"tools": [ [ [ "surface_heat", 10, "LIST" ] ] ],
"components": [
[ [ "water", 4 ], [ "water_clean", 4 ] ],
[ [ "meal_bone", 2 ], [ "meal_bone_tainted", 4 ] ],
[ [ "meal_chitin_piece", 1 ] ],
[ [ "feces_bird", 10 ], [ "feces_roach", 10 ], [ "feces_cow", 4 ], [ "feces_manure", 6 ] ]
]
"components": [ [ [ "fermented_fertilizer_liquid", 1 ] ] ]
},
{
"type": "recipe",
Expand Down
13 changes: 13 additions & 0 deletions data/json/recipes/recipe_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,19 @@
"qualities": [ { "id": "SAW_M", "level": 1 }, { "id": "SCREW", "level": 1 } ],
"components": [ [ [ "propane_lantern", 1 ] ], [ [ "pilot_light", 1 ] ], [ [ "metal_tank_little", 1 ] ], [ [ "duct_tape", 50 ] ] ]
},
{
"type": "recipe",
"activity_level": "NO_EXERCISE",
"result": "biogas_cooker",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_TOOLS",
"skill_used": "fabrication",
"difficulty": 4,
"time": "1 m",
"reversible": true,
"autolearn": true,
"components": [ [ [ "propane_cooker", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
Expand Down
Loading

0 comments on commit 326e9b2

Please sign in to comment.