From 891d1b7854b4612bc2c3a14ffcf12184fca504e8 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Wed, 22 Oct 2025 05:13:44 -0400 Subject: [PATCH] Biogenerator Stuff (#21469) This PR introduces some new quality of life to biogenerators by fixing and updating their mechanics hints, which previously didn't work. The upgrade hints were also improved so that in addition to actually working, they state the current numerical effects of the parts used. I've also added a few new items that can be made by a biogenerator, such as large plant pots, new stickers, and medical splints (since they're intended to be able to make basic first aid kits, which normally include a set of splints). As a small balancing factor(and in preparation for a planned update to part upgrading), I've fixed up the math for small biogenerators to account for float based part ratings. So instead of linearly dropping the rating of parts by 1, it makes upgrades 33% less effective. Without upgrades: image With upgrades: image image --- code/game/machinery/biogenerator.dm | 100 +++++++++++++++--- .../circuitboards/machinery/biogenerator.dm | 3 +- .../hellfirejag-biogenerator-stuff.yml | 8 ++ 3 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 html/changelogs/hellfirejag-biogenerator-stuff.yml diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index df534df99da..16cf0c1a7f8 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -10,21 +10,55 @@ var/obj/item/reagent_containers/glass/beaker = null var/points = 0 var/menustat = "menu" + + /** + * Upgrading the biogenerator's manipulators makes it consume less biomass to make items. + * Biomass costs are divided by this variable, and are calculated as the sum of its manipulator part ratings. + */ var/build_eff = 1 + + /** + * Upgrading the biogenerator's matter bins makes it generate more biomass from nutriment. + * This multiplier is calculated as the sum of the machine's matter bin part ratings. + * Biomass generation is equal to eat_eff * biomass_from_nutriment. + */ var/eat_eff = 1 + + /** + * Upgrading the biogenerator's capacitors makes it process nutriments faster. + * Nutriment processing times are divided by this variable, and are calculated as the sum of its capacitor part ratings. + */ + var/processing_time_divisor = 1 + + /// The amount of biomass this machine generates per unit of nutriment consumed. + var/biomass_per_nutriment = 10 + + /// The maximum number of items this machine can store at a time for processing. var/capacity = 100 + var/ref_for_ui component_types = list( /obj/item/circuitboard/biogenerator, /obj/item/stock_parts/matter_bin, - /obj/item/stock_parts/manipulator + /obj/item/stock_parts/manipulator, + /obj/item/stock_parts/capacitor ) +/obj/machinery/biogenerator/mechanics_hints(mob/user, distance, is_adjacent) + . = ..() + . += "Food can be placed inside this machine by either left clicking it with food items directly, or by left clicking on it with a plant bag." + . += "Any nutriments inside food are converted into biomass, which can be used by this machine to create a variety of useful items." + . += "Non-nutriment reagents will clog up the machine, making it take longer to process foods." + /obj/machinery/biogenerator/upgrade_hints(mob/user, distance, is_adjacent) . += ..() - . += "Upgraded manipulators will increase the nutrients provided by new inputs." - . += "Upgraded matter bins will decrease the conversion cost of bio-goods." + . += "Upgraded manipulators will decrease the cost of bio-goods." + . += "The current cost decrease is [round((1 - (1/build_eff)) * 100)]%." + . += "Upgraded matter bins will increase the biomass generated from nutriments." + . += "The current amount of biomass produced is [biomass_per_nutriment * eat_eff] per unit of nutriment." + . += "Upgraded capacitors will increase the rate at which nutriments are processed." + . += "The current processing speed increase is [round((1 - (1/processing_time_divisor)) * 100)]%." #define BIOGEN_FOOD "Food" #define BIOGEN_ITEMS "Items" @@ -227,7 +261,12 @@ ITEMS object = /obj/item/flame/lighter/random cost = 100 -/singleton/biorecipe/item/pottedplant +/singleton/biorecipe/item/potted_plant + name = "Large Plant Pot" + object = /obj/random/pottedplant + cost = 750 + +/singleton/biorecipe/item/pottedplant_small name = "Small Plant Pot" object = /obj/random/pottedplant_small cost = 300 @@ -247,6 +286,21 @@ ITEMS object = /obj/item/storage/stickersheet/goldstar cost = 600 +/singleton/biorecipe/item/googly_eye + name = "Googly Eye Sticker Sheet" + object = /obj/item/storage/stickersheet/googly_eye + cost = 600 + +/singleton/biorecipe/item/generic + name = "Generic Sticker Sheet" + object = /obj/item/storage/stickersheet/generic + cost = 600 + +/singleton/biorecipe/item/hearts + name = "Heart Sticker Sheet" + object = /obj/item/storage/stickersheet/hearts + cost = 600 + /singleton/biorecipe/item/plantbag name = "Plant Bag" object = /obj/item/storage/bag/plants @@ -370,7 +424,7 @@ MEDICAL cost = 500 /singleton/biorecipe/medical - name = "Bruise Pack" + name = "Roll of Gauze" class = BIOGEN_MEDICAL object = /obj/item/stack/medical/bruise_pack cost = 400 @@ -386,6 +440,11 @@ MEDICAL cost = 250 amount = list(1,2,3,5,7) +/singleton/biorecipe/medical/splints + name = "Splints" + object = /obj/item/stack/medical/splint + cost = 400 + /* CONSTRUCTION */ @@ -679,9 +738,7 @@ EMAG/ILLEGAL var/S = 0 for(var/obj/item/reagent_containers/food/snacks/I in contents) S += 5 - if(REAGENT_VOLUME(I.reagents, /singleton/reagent/nutriment) < 0.1) - points += 1 - else points += REAGENT_VOLUME(I.reagents, /singleton/reagent/nutriment) * 10 * eat_eff + points += REAGENT_VOLUME(I.reagents, /singleton/reagent/nutriment) * biomass_per_nutriment * eat_eff qdel(I) CHECK_TICK if(S) @@ -691,7 +748,7 @@ EMAG/ILLEGAL playsound(src.loc, 'sound/machines/juicer.ogg', 50, 1) intent_message(MACHINE_SOUND) use_power_oneoff(S * 30) - sleep((S + 1.5 SECONDS) / eat_eff) + sleep((S + 1.5 SECONDS) / processing_time_divisor) processing = 0 update_icon() else @@ -762,9 +819,9 @@ EMAG/ILLEGAL return 1 /obj/machinery/biogenerator/Topic(href, href_list) - if(stat & BROKEN) return - if(usr.stat || usr.restrained()) return - if(!in_range(src, usr)) return + ..() // Run the base topic code so that our mechanics hints still work. + if(stat & BROKEN || usr.stat || usr.restrained() || !in_range(src, usr)) + return usr.set_machine(src) @@ -787,15 +844,20 @@ EMAG/ILLEGAL ..() var/man_rating = 0 var/bin_rating = 0 + var/capacitor_rating = 0 for(var/obj/item/stock_parts/P in component_parts) if(ismatterbin(P)) bin_rating += P.rating + else if(iscapacitor(P)) + capacitor_rating += P.rating else if(ismanipulator(P)) man_rating += P.rating - build_eff = man_rating - eat_eff = bin_rating + // We're doing a lot of division with these variables, so all of these have to be sanity checked to prevent any accidental divisions by zero. + build_eff = max(1, man_rating) + eat_eff = max(1, bin_rating) + processing_time_divisor = max(1, capacitor_rating) /obj/machinery/biogenerator/small icon_state = "biogen_small" @@ -805,7 +867,8 @@ EMAG/ILLEGAL component_types = list( /obj/item/circuitboard/biogenerator/small, /obj/item/stock_parts/matter_bin, - /obj/item/stock_parts/manipulator + /obj/item/stock_parts/manipulator, + /obj/item/stock_parts/capacitor ) /obj/machinery/biogenerator/small/north @@ -828,5 +891,8 @@ EMAG/ILLEGAL /obj/machinery/biogenerator/small/RefreshParts() ..() - build_eff = max(build_eff - 1, 1) - eat_eff = max(eat_eff - 1, 1) + // Upgraded parts are less efficient on small biogenerators. + // Tier 3 parts are equivalent to tier 2 parts for them, while tier 2 parts are only 33% more effective than tier 1 parts. + build_eff = max(build_eff * 0.667, 1) + eat_eff = max(eat_eff * 0.667, 1) + processing_time_divisor = max(processing_time_divisor * 0.667, 1) diff --git a/code/game/objects/items/weapons/circuitboards/machinery/biogenerator.dm b/code/game/objects/items/weapons/circuitboards/machinery/biogenerator.dm index 4360c0863bd..21161987eac 100644 --- a/code/game/objects/items/weapons/circuitboards/machinery/biogenerator.dm +++ b/code/game/objects/items/weapons/circuitboards/machinery/biogenerator.dm @@ -9,7 +9,8 @@ origin_tech = list(TECH_DATA = 2) req_components = list( "/obj/item/stock_parts/matter_bin" = 1, - "/obj/item/stock_parts/manipulator" = 1) + "/obj/item/stock_parts/manipulator" = 1, + "/obj/item/stock_parts/capacitor" = 1) /obj/item/circuitboard/biogenerator/small name = T_BOARD("small biogenerator") diff --git a/html/changelogs/hellfirejag-biogenerator-stuff.yml b/html/changelogs/hellfirejag-biogenerator-stuff.yml new file mode 100644 index 00000000000..943ec2b7266 --- /dev/null +++ b/html/changelogs/hellfirejag-biogenerator-stuff.yml @@ -0,0 +1,8 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Fixed upgrade hints for biogenerators. Upgrade hints now show the actual current numerical effects of parts." + - rscadd: "Added mechanics hints for biogenerators." + - rscadd: "Biogenerators now also require capacitors, which increase their processing speed." + - rscadd: "Biogenerators can now produce splints, as well as more variety of stickers." + - balance: "Small biogenerators such as the one in the garden aren't as strongly upgraded by better parts as the full-sized biogenerator."