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.

<img alt="060ybChTkI"
src="https://user-images.githubusercontent.com/3625094/209483256-e4159a05-46ae-47b8-bc42-9d003cf6c303.png">

## Why It's Good For The Game

Better representation of a reagent.

## Changelog

🆑
qol: Biogenerator shows default reagent containers instead of beakers
/🆑
This commit is contained in:
Andrew
2023-01-03 21:20:30 -08:00
committed by GitHub
parent 151caa643e
commit fd1ea8d5b5
8 changed files with 32 additions and 31 deletions
+1 -1
View File
@@ -355,7 +355,7 @@
. += span_notice("The status display reads: Storing up to <b>[materials.max_amount]</b> material units.<br>Material consumption at <b>[creation_efficiency*100]%</b>.")
/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)
@@ -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
+4 -4
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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.
@@ -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
+3 -3
View File
@@ -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