From fd1ea8d5b5578ba633d8d1e479dc2da8772ccfbe Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 4 Jan 2023 08:20:30 +0300 Subject: [PATCH] Biogen shows default reagent container icons instead of beakers (#72247) ## About The Pull Request With the new crafting menu some reagents now have default container assigned. I applied these to visualize reagents in biogen UI too. 060ybChTkI ## Why It's Good For The Game Better representation of a reagent. ## Changelog :cl: qol: Biogenerator shows default reagent containers instead of beakers /:cl: --- code/game/machinery/autolathe.dm | 2 +- .../asset_cache/assets/research_designs.dm | 7 ++-- code/modules/hydroponics/biogenerator.dm | 8 ++--- code/modules/mining/machine_processing.dm | 2 +- code/modules/mining/machine_redemption.dm | 2 +- code/modules/research/designs.dm | 4 +-- .../research/designs/biogenerator_designs.dm | 32 +++++++++---------- code/modules/unit_tests/designs.dm | 6 ++-- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 0e29e62bf24..04d0efa487a 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -355,7 +355,7 @@ . += span_notice("The status display reads: Storing up to [materials.max_amount] material units.
Material consumption at [creation_efficiency*100]%.") /obj/machinery/autolathe/proc/can_build(datum/design/D, amount = 1) - if(length(D.make_reagents)) + if(D.make_reagent) return FALSE var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : creation_efficiency) diff --git a/code/modules/asset_cache/assets/research_designs.dm b/code/modules/asset_cache/assets/research_designs.dm index 62a03040517..feeeee05c7c 100644 --- a/code/modules/asset_cache/assets/research_designs.dm +++ b/code/modules/asset_cache/assets/research_designs.dm @@ -23,9 +23,10 @@ // construct the icon and slap it into the resource cache var/atom/item = initial(D.build_path) if (!ispath(item, /atom)) - // biogenerator outputs to beakers by default - if (initial(D.build_type) & BIOGENERATOR) - item = /obj/item/reagent_containers/cup/beaker/large + // biogenerator reagent designs display their default container + if(initial(D.make_reagent)) + var/datum/reagent/reagent = initial(D.make_reagent) + item = initial(reagent.default_container) else continue // shouldn't happen, but just in case diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index fee4b6da3ee..b80fa655795 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -344,7 +344,7 @@ /obj/machinery/biogenerator/proc/create_product(datum/design/design, amount) - if(design.make_reagents.len > 0) + if(design.make_reagent) if(!beaker) return FALSE @@ -355,7 +355,7 @@ if(!use_biomass(design.materials, amount)) return FALSE - beaker.reagents.add_reagent(design.make_reagents[1], amount) + beaker.reagents.add_reagent(design.make_reagent, amount) if(design.build_path) if(!use_biomass(design.materials, amount)) @@ -485,7 +485,7 @@ cat["items"] += list(list( "id" = design.id, "name" = design.name, - "is_reagent" = design.make_reagents.len > 0, + "is_reagent" = design.make_reagent != null, "cost" = design.materials[GET_MATERIAL_REF(/datum/material/biomass)] / efficiency, )) data["categories"] += list(cat) @@ -518,7 +518,7 @@ return var/datum/design/design = SSresearch.techweb_design_by_id(id) - amount = clamp(amount, 1, (design.make_reagents.len > 0 && beaker ? beaker.reagents.maximum_volume - beaker.reagents.total_volume : max_output)) + amount = clamp(amount, 1, (design.make_reagent && beaker ? beaker.reagents.maximum_volume - beaker.reagents.total_volume : max_output)) if(design && !istype(design, /datum/design/error_design)) create_product(design, amount) diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index f7163499d0d..4460db4de9a 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -259,7 +259,7 @@ generate_mineral(alloy.build_path) /obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D, delta_time = 2) - if(D.make_reagents.len) + if(D.make_reagent) return FALSE var/build_amount = SMELT_AMOUNT * delta_time diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 66ab8ec2931..73b12cd957b 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -71,7 +71,7 @@ /obj/machinery/mineral/ore_redemption/proc/can_smelt_alloy(datum/design/D) var/datum/component/material_container/mat_container = materials.mat_container - if(!mat_container || D.make_reagents.len) + if(!mat_container || D.make_reagent) return FALSE var/build_amount = 0 diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index b1eee4ba1b9..17c562686ab 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -35,8 +35,8 @@ other types of metals and chemistry for reagents). var/construction_time /// The typepath of the object produced by this design var/build_path = null - /// List of reagents produced by this design. Currently only supported by the biogenerator. - var/list/make_reagents = list() + /// Reagent produced by this design. Currently only supported by the biogenerator. + var/make_reagent /// What categories this design falls under. Used for sorting in production machines. var/list/category = list() /// List of reagents required to create one unit of the product. diff --git a/code/modules/research/designs/biogenerator_designs.dm b/code/modules/research/designs/biogenerator_designs.dm index 6984ad751a2..045f5ee7c4b 100644 --- a/code/modules/research/designs/biogenerator_designs.dm +++ b/code/modules/research/designs/biogenerator_designs.dm @@ -7,7 +7,7 @@ id = "milk" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.4) - make_reagents = list(/datum/reagent/consumable/milk = 1) + make_reagent = /datum/reagent/consumable/milk category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/soymilk @@ -15,7 +15,7 @@ id = "soymilk" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.4) - make_reagents = list(/datum/reagent/consumable/soymilk = 1) + make_reagent = /datum/reagent/consumable/soymilk category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/ethanol @@ -23,7 +23,7 @@ id = "ethanol" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/ethanol = 1) + make_reagent = /datum/reagent/consumable/ethanol category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/cream @@ -31,7 +31,7 @@ id = "cream" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/cream = 1) + make_reagent = /datum/reagent/consumable/cream category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/black_pepper @@ -39,7 +39,7 @@ id = "black_pepper" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/blackpepper = 1) + make_reagent = /datum/reagent/consumable/blackpepper category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/enzyme @@ -47,7 +47,7 @@ id = "enzyme" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/enzyme = 1) + make_reagent = /datum/reagent/consumable/enzyme category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/flour @@ -55,7 +55,7 @@ id = "flour_sack" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/flour = 1) + make_reagent = /datum/reagent/consumable/flour category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/sugar @@ -63,7 +63,7 @@ id = "sugar" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/consumable/sugar = 1) + make_reagent = /datum/reagent/consumable/sugar category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_FOOD) /datum/design/monkey_cube @@ -87,7 +87,7 @@ id = "ez_nut" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.1) - make_reagents = list(/datum/reagent/plantnutriment/eznutriment = 1) + make_reagent = /datum/reagent/plantnutriment/eznutriment category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/l4z_nut @@ -95,7 +95,7 @@ id = "l4z_nut" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.1) - make_reagents = list(/datum/reagent/plantnutriment/left4zednutriment = 1) + make_reagent = /datum/reagent/plantnutriment/left4zednutriment category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/rh_nut @@ -103,7 +103,7 @@ id = "rh_nut" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.2) - make_reagents = list(/datum/reagent/plantnutriment/robustharvestnutriment = 1) + make_reagent = /datum/reagent/plantnutriment/robustharvestnutriment category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/end_gro @@ -111,7 +111,7 @@ id = "end_gro" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.3) - make_reagents = list(/datum/reagent/plantnutriment/endurogrow = 1) + make_reagent = /datum/reagent/plantnutriment/endurogrow category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/liq_earth @@ -119,7 +119,7 @@ id = "liq_earth" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.3) - make_reagents = list(/datum/reagent/plantnutriment/liquidearthquake = 1) + make_reagent = /datum/reagent/plantnutriment/liquidearthquake category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/weed_killer @@ -127,7 +127,7 @@ id = "weed_killer" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.2) - make_reagents = list(/datum/reagent/toxin/plantbgone/weedkiller = 1) + make_reagent = /datum/reagent/toxin/plantbgone/weedkiller category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/pest_spray @@ -135,7 +135,7 @@ id = "pest_spray" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.4) - make_reagents = list(/datum/reagent/toxin/pestkiller = 1) + make_reagent = /datum/reagent/toxin/pestkiller category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/org_pest_spray @@ -143,7 +143,7 @@ id = "org_pest_spray" build_type = BIOGENERATOR materials = list(/datum/material/biomass = 0.6) - make_reagents = list(/datum/reagent/toxin/pestkiller/organic = 1) + make_reagent = /datum/reagent/toxin/pestkiller/organic category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_BIO_CHEMICALS) /datum/design/leather diff --git a/code/modules/unit_tests/designs.dm b/code/modules/unit_tests/designs.dm index 7ba2bbec997..a9cda144649 100644 --- a/code/modules/unit_tests/designs.dm +++ b/code/modules/unit_tests/designs.dm @@ -14,10 +14,10 @@ if (isnull(current_design.name) || current_design.name == default_design.name) //Designs with ID must have non default/null Name TEST_FAIL("Design [current_design.type] has default or null name var but has an ID") if ((!isnull(current_design.materials) && LAZYLEN(current_design.materials)) || (!isnull(current_design.reagents_list) && LAZYLEN(current_design.reagents_list))) //Design requires materials - if ((isnull(current_design.build_path) || current_design.build_path == default_design.build_path) && (isnull(current_design.make_reagents) || current_design.make_reagents == default_design.make_reagents)) //Check if design gives any output - TEST_FAIL("Design [current_design.type] requires materials but does not have have any build_path or make_reagents set") + if ((isnull(current_design.build_path) || current_design.build_path == default_design.build_path) && (isnull(current_design.make_reagent) || current_design.make_reagent == default_design.make_reagent)) //Check if design gives any output + TEST_FAIL("Design [current_design.type] requires materials but does not have have any build_path or make_reagent set") else if (!isnull(current_design.build_path) || !isnull(current_design.build_path)) // //Design requires no materials but creates stuff - TEST_FAIL("Design [current_design.type] requires NO materials but has build_path or make_reagents set") + TEST_FAIL("Design [current_design.type] requires NO materials but has build_path or make_reagent set") for(var/path in subtypesof(/datum/design/surgery)) var/datum/design/surgery/current_design = new path //Create an instance of each design