From fdd416fa5e6a1398604870c2ea0f86d56c690a47 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Wed, 24 May 2023 13:28:33 -0500 Subject: [PATCH] Removes a lot of boilerplate from hydroponics apply, adds a mushroom mechanic for milk as implied by comments (#75491) ## About The Pull Request - Removes a ton of boilerplate from `on_hydroponics_apply` - Replaces `chems.get_reagent_amount(type)` with `volume`. The former is a roundabout way of accomplishing the latter, the only thing the proc did was add un-necessary iterating and also round to the chemical quantisiation level, which wasn't really necessary as most locations rounded anyways. - While doing this, I saw th is comment: `Milk is good for humans, but bad for plants. The sugars cannot be used by plants, and the milk fat harms growth. Not shrooms though. I can't deal with this now...` This was super easy to just throw in so I did it. - Additionally, I noticed Uranium and Radium had this var, `tox_damage`, which was ... the same for both, but one used REM and one didn't, but it shouldn't have been using REM since it was multiplied by REM in the proc... so I removed the REM from the latter, making it doubly strong (0.5 -> 1). I did this just because I could use it nicely for the hydro proc but... I unno. ## Why It's Good For The Game Makes it a bit clearer on working with hydro chems ## Changelog :cl: Melbert balance: Milk no longer harms the potency of mushrooms. Apparently it's good for them? balance: Radium now does slightly more tox damage than Uranium code: Removed a ton of boilerplate from chem hydro interactions /:cl: --- .../hydroponics/hydroponics_chemreact.dm | 8 +- code/modules/reagents/chemistry/reagents.dm | 16 +- .../chemistry/reagents/alcohol_reagents.dm | 9 +- .../reagents/cat2_medicine_reagents.dm | 7 +- .../chemistry/reagents/drink_reagents.dm | 22 +- .../chemistry/reagents/drug_reagents.dm | 7 +- .../chemistry/reagents/food_reagents.dm | 39 ++-- .../chemistry/reagents/medicine_reagents.dm | 47 ++-- .../chemistry/reagents/other_reagents.dm | 206 +++++++----------- .../reagents/pyrotechnic_reagents.dm | 22 +- .../chemistry/reagents/toxin_reagents.dm | 68 ++---- 11 files changed, 166 insertions(+), 285 deletions(-) diff --git a/code/modules/hydroponics/hydroponics_chemreact.dm b/code/modules/hydroponics/hydroponics_chemreact.dm index c9cf3ce8606..c05e0ab0ff4 100644 --- a/code/modules/hydroponics/hydroponics_chemreact.dm +++ b/code/modules/hydroponics/hydroponics_chemreact.dm @@ -6,10 +6,10 @@ ///Contains the reagents within the tray. if(myseed) myseed.on_chem_reaction(reagents) //In case seeds have some special interactions with special chems, currently only used by vines - for(var/c in reagents.reagent_list) - var/datum/reagent/chem = c - chem.on_hydroponics_apply(myseed, reagents, src, user) - + for(var/datum/reagent/chem as anything in reagents.reagent_list) + if(chem.volume < 1) + continue + chem.on_hydroponics_apply(src, user) /obj/machinery/hydroponics/proc/mutation_roll(mob/user) switch(rand(100)) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index b2916787093..ce4e11d9f0d 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -228,20 +228,12 @@ Primarily used in reagents/reaction_agents return /** - * New, standardized method for chemicals to affect hydroponics trays. - * Defined on a per-chem level as opposed to by the tray. + * Called when this chemical is processed in a hydroponics tray. + * * Can affect plant's health, stats, or cause the plant to react in certain ways. */ -/datum/reagent/proc/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - -/// Proc is used by [/datum/reagent/proc/on_hydroponics_apply] to see if the tray and the reagents inside is in a valid state to apply reagent effects -/datum/reagent/proc/check_tray(datum/reagents/chems, obj/machinery/hydroponics/mytray) - ASSERT(mytray) - // Check if we have atleast a single amount of the reagent - if(!chems.has_reagent(type, 1)) - return FALSE - - return TRUE +/datum/reagent/proc/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + return /// Should return a associative list where keys are taste descriptions and values are strength ratios /datum/reagent/proc/get_taste_description(mob/living/taster) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index fcdfd8aa11f..77c2903044a 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -113,12 +113,9 @@ icon_state = "beerglass" // Beer is a chemical composition of alcohol and various other things. It's a garbage nutrient but hey, it's still one. Also alcohol is bad, mmmkay? -/datum/reagent/consumable/ethanol/beer/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 0.05)) - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 0.7)) +/datum/reagent/consumable/ethanol/beer/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 0.05)) + mytray.adjust_waterlevel(round(volume * 0.7)) /datum/reagent/consumable/ethanol/beer/light name = "Light Beer" diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index f37a3e2c075..c512a63b729 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -365,11 +365,8 @@ return TRUE // Antitoxin binds plants pretty well. So the tox goes significantly down -/datum/reagent/medicine/c2/multiver/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(-(round(chems.get_reagent_amount(type) * 2)*normalise_creation_purity())) //0-2.66, 2 by default (0.75 purity). +/datum/reagent/medicine/c2/multiver/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(-(round(volume * 2)*normalise_creation_purity())) //0-2.66, 2 by default (0.75 purity). #define issyrinormusc(A) (istype(A,/datum/reagent/medicine/c2/syriniver) || istype(A,/datum/reagent/medicine/c2/musiver)) //musc is metab of syrin so let's make sure we're not purging either diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index a76916d1c61..0992400d622 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -308,13 +308,14 @@ icon_state = "milkbox" drink_type = DAIRY | BREAKFAST - // Milk is good for humans, but bad for plants. The sugars cannot be used by plants, and the milk fat harms growth. Not shrooms though. I can't deal with this now... -/datum/reagent/consumable/milk/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) +// Milk is good for humans, but bad for plants. +// The sugars cannot be used by plants, and the milk fat harms growth. Except shrooms. +/datum/reagent/consumable/milk/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_waterlevel(round(volume * 0.3)) + var/obj/item/seeds/myseed = mytray.myseed + if(isnull(myseed) || myseed.get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)) return - - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 0.3)) - myseed?.adjust_potency(-chems.get_reagent_amount(type) * 0.5) + myseed.adjust_potency(-round(volume * 0.5)) /datum/reagent/consumable/milk/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) if(affected_mob.getBruteLoss() && SPT_PROB(10, seconds_per_tick)) @@ -807,12 +808,9 @@ // A variety of nutrients are dissolved in club soda, without sugar. // These nutrients include carbon, oxygen, hydrogen, phosphorous, potassium, sulfur and sodium, all of which are needed for healthy plant growth. -/datum/reagent/consumable/sodawater/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type))) - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.1)) +/datum/reagent/consumable/sodawater/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_waterlevel(round(volume)) + mytray.adjust_plant_health(round(volume * 0.1)) /datum/reagent/consumable/sodawater/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) affected_mob.adjust_dizzy(-10 SECONDS * REM * seconds_per_tick) diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index b00dab7675e..2baf1b3afa1 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -74,11 +74,8 @@ addiction_types = list(/datum/addiction/nicotine = 15) // 6 per 2 seconds //Nicotine is used as a pesticide IRL. -/datum/reagent/drug/nicotine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(round(chems.get_reagent_amount(type))) +/datum/reagent/drug/nicotine/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(round(volume)) mytray.adjust_pestlevel(-rand(1, 2)) /datum/reagent/drug/nicotine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index f6b84589768..ead07322184 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -60,11 +60,8 @@ var/brute_heal = 1 var/burn_heal = 0 -/datum/reagent/consumable/nutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.2)) +/datum/reagent/consumable/nutriment/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(round(volume * 0.2)) /datum/reagent/consumable/nutriment/on_mob_life(mob/living/carbon/M, seconds_per_tick, times_fired) if(SPT_PROB(30, seconds_per_tick)) @@ -250,12 +247,9 @@ default_container = /obj/item/reagent_containers/condiment/sugar // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... -/datum/reagent/consumable/sugar/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_weedlevel(rand(1,2)) - mytray.adjust_pestlevel(rand(1,2)) +/datum/reagent/consumable/sugar/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_weedlevel(rand(1, 2)) + mytray.adjust_pestlevel(rand(1, 2)) /datum/reagent/consumable/sugar/overdose_start(mob/living/M) to_chat(M, span_userdanger("You go into hyperglycaemic shock! Lay off the twinkies!")) @@ -275,12 +269,9 @@ taste_description = "watery milk" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - // Compost for EVERYTHING -/datum/reagent/consumable/virus_food/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 0.5)) +// Compost for EVERYTHING +/datum/reagent/consumable/virus_food/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 0.5)) /datum/reagent/consumable/soysauce name = "Soysauce" @@ -700,16 +691,14 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED default_container = /obj/item/reagent_containers/condiment/honey - // On the other hand, honey has been known to carry pollen with it rarely. Can be used to take in a lot of plant qualities all at once, or harm the plant. -/datum/reagent/consumable/honey/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) +// On the other hand, honey has been known to carry pollen with it rarely. Can be used to take in a lot of plant qualities all at once, or harm the plant. +/datum/reagent/consumable/honey/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + if(!isnull(mytray.myseed) && prob(20)) + mytray.pollinate(range = 1) return - if(myseed && prob(20)) - mytray.pollinate(1) - else - mytray.adjust_weedlevel(rand(1,2)) - mytray.adjust_pestlevel(rand(1,2)) + mytray.adjust_weedlevel(rand(1, 2)) + mytray.adjust_pestlevel(rand(1, 2)) /datum/reagent/consumable/honey/on_mob_life(mob/living/carbon/M, seconds_per_tick, times_fired) holder.add_reagent(/datum/reagent/consumable/sugar, 3 * REM * seconds_per_tick) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index e5f5e18383a..eaf241640a1 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -46,25 +46,24 @@ var/full_heal_flags = ~(HEAL_BRUTE|HEAL_BURN|HEAL_TOX|HEAL_RESTRAINTS|HEAL_REFRESH_ORGANS) // The best stuff there is. For testing/debugging. -/datum/reagent/medicine/adminordrazine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type))) - mytray.adjust_plant_health(round(chems.get_reagent_amount(type))) +/datum/reagent/medicine/adminordrazine/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_waterlevel(round(volume)) + mytray.adjust_plant_health(round(volume)) mytray.adjust_pestlevel(-rand(1,5)) mytray.adjust_weedlevel(-rand(1,5)) - if(chems.has_reagent(type, 3)) - switch(rand(100)) - if(66 to 100) - mytray.mutatespecie() - if(33 to 65) - mytray.mutateweed() - if(1 to 32) - mytray.mutatepest(user) - else - if(prob(20)) - mytray.visible_message(span_warning("Nothing happens...")) + if(volume < 3) + return + + switch(rand(100)) + if(66 to 100) + mytray.mutatespecie() + if(33 to 65) + mytray.mutateweed() + if(1 to 32) + mytray.mutatepest(user) + else + if(prob(20)) + mytray.visible_message(span_warning("Nothing happens...")) /datum/reagent/medicine/adminordrazine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) affected_mob.heal_bodypart_damage(5 * REM * seconds_per_tick, 5 * REM * seconds_per_tick, 0, FALSE, affected_bodytype) @@ -167,12 +166,9 @@ return TRUE // Healing -/datum/reagent/medicine/cryoxadone/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 3)) - mytray.adjust_toxic(-round(chems.get_reagent_amount(type) * 3)) +/datum/reagent/medicine/cryoxadone/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(round(volume * 3)) + mytray.adjust_toxic(-round(volume * 3)) /datum/reagent/medicine/clonexadone name = "Clonexadone" @@ -907,10 +903,7 @@ description += " It appears to be pulsing with a warm pink light." // FEED ME SEYMOUR -/datum/reagent/medicine/strange_reagent/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - +/datum/reagent/medicine/strange_reagent/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) mytray.spawnplant() /// Calculates the amount of reagent to at a bare minimum make the target not dead diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 7aae216d9f4..33aab793f2d 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -20,11 +20,8 @@ icon_state = "glass_red" // FEED ME -/datum/reagent/blood/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_pestlevel(rand(2,3)) +/datum/reagent/blood/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_pestlevel(rand(2, 3)) /datum/reagent/blood/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume, show_message=TRUE, touch_protection=0) . = ..() @@ -265,14 +262,11 @@ if(affected_mob.blood_volume) affected_mob.blood_volume += 0.1 * REM * seconds_per_tick // water is good for you! -///For weird backwards situations where water manages to get added to trays nutrients, as opposed to being snowflaked away like usual. -/datum/reagent/water/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type))) +// For weird backwards situations where water manages to get added to trays nutrients, as opposed to being snowflaked away like usual. +/datum/reagent/water/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_waterlevel(round(volume)) //You don't belong in this world, monster! - chems.remove_reagent(/datum/reagent/water, chems.get_reagent_amount(type)) + mytray.reagents.remove_reagent(type, volume) /datum/reagent/water/holywater name = "Holy Water" @@ -289,14 +283,11 @@ desc = "A glass of holy water." icon_state = "glass_clear" - // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits. Also ALSO increases instability. -/datum/reagent/water/holywater/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_waterlevel(round(chems.get_reagent_amount(type))) - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.1)) - myseed?.adjust_instability(round(chems.get_reagent_amount(type) * 0.15)) +// Holy water. Unlike water, which is nuked, stays in and heals the plant a little with the power of the spirits. Also ALSO increases instability. +/datum/reagent/water/holywater/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_waterlevel(round(volume)) + mytray.adjust_plant_health(round(volume * 0.1)) + mytray.myseed?.adjust_instability(round(volume * 0.15)) /datum/reagent/water/holywater/on_mob_metabolize(mob/living/affected_mob) ..() @@ -939,14 +930,11 @@ // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial -/datum/reagent/chlorine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type))) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 1.5)) - mytray.adjust_waterlevel(-round(chems.get_reagent_amount(type) * 0.5)) - mytray.adjust_weedlevel(-rand(1,3)) +/datum/reagent/chlorine/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume)) + mytray.adjust_toxic(round(volume * 1.5)) + mytray.adjust_waterlevel(-round(volume * 0.5)) + mytray.adjust_weedlevel(-rand(1, 3)) // White Phosphorous + water -> phosphoric acid. That's not a good thing really. @@ -965,14 +953,11 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial -/datum/reagent/fluorine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 2)) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 2.5)) - mytray.adjust_waterlevel(-round(chems.get_reagent_amount(type) * 0.5)) - mytray.adjust_weedlevel(-rand(1,4)) +/datum/reagent/fluorine/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 2)) + mytray.adjust_toxic(round(volume * 2.5)) + mytray.adjust_waterlevel(-round(volume * 0.5)) + mytray.adjust_weedlevel(-rand(1, 4)) /datum/reagent/fluorine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) affected_mob.adjustToxLoss(0.5*REM*seconds_per_tick, 0) @@ -998,13 +983,10 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED // Phosphoric salts are beneficial though. And even if the plant suffers, in the long run the tray gets some nutrients. The benefit isn't worth that much. -/datum/reagent/phosphorus/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 0.75)) - mytray.adjust_waterlevel(-round(chems.get_reagent_amount(type) * 0.5)) - mytray.adjust_weedlevel(-rand(1,2)) +/datum/reagent/phosphorus/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 0.75)) + mytray.adjust_waterlevel(-round(volume * 0.5)) + mytray.adjust_weedlevel(-rand(1, 2)) /datum/reagent/lithium name = "Lithium" @@ -1080,17 +1062,17 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/uranium - name ="Uranium" + name = "Uranium" description = "A jade-green metallic chemical element in the actinide series, weakly radioactive." reagent_state = SOLID color = "#5E9964" //this used to be silver, but liquid uranium can still be green and it's more easily noticeable as uranium like this so why bother? taste_description = "the inside of a reactor" - /// How much tox damage to deal per tick - var/tox_damage = 0.5 ph = 4 material = /datum/material/uranium chemical_flags = REAGENT_CAN_BE_SYNTHESIZED default_container = /obj/effect/decal/cleanable/greenglow + /// How much tox damage to deal per tick + var/tox_damage = 0.5 /datum/reagent/uranium/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) affected_mob.adjustToxLoss(tox_damage * seconds_per_tick * REM) @@ -1108,14 +1090,10 @@ glow.reagents.add_reagent(type, reac_volume) //Mutagenic chem side-effects. -/datum/reagent/uranium/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - +/datum/reagent/uranium/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) mytray.mutation_roll(user) - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type))) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 2)) + mytray.adjust_plant_health(-round(volume)) + mytray.adjust_toxic(round(volume / tox_damage)) // more damage = more /datum/reagent/uranium/radium name = "Radium" @@ -1123,20 +1101,11 @@ reagent_state = SOLID color = "#00CC00" // ditto taste_description = "the colour blue and regret" - tox_damage = 1*REM + tox_damage = 1 material = null ph = 10 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/uranium/radium/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.mutation_roll(user) - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type))) - mytray.adjust_toxic(round(chems.get_reagent_amount(type))) - /datum/reagent/bluespace name = "Bluespace Dust" description = "A dust composed of microscopic bluespace crystals, with minor space-warping properties." @@ -1403,12 +1372,12 @@ ph = 11.6 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/ammonia/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return +/datum/reagent/ammonia/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) // Ammonia is bad ass. - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.12)) - if(myseed && prob(10)) + mytray.adjust_plant_health(round(volume * 0.12)) + + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed) && prob(10)) myseed.adjust_yield(1) myseed.adjust_instability(1) @@ -1421,15 +1390,13 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. The new trade off is it culls stability. -/datum/reagent/diethylamine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(round(chems.get_reagent_amount(type))) +/datum/reagent/diethylamine/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(round(volume)) mytray.adjust_pestlevel(-rand(1,2)) - if(myseed) - myseed.adjust_yield(round(chems.get_reagent_amount(type))) - myseed.adjust_instability(-round(chems.get_reagent_amount(type))) + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed)) + myseed.adjust_yield(round(volume)) + myseed.adjust_instability(-round(volume)) /datum/reagent/carbondioxide name = "Carbon Dioxide" @@ -1647,13 +1614,12 @@ tox_prob = 5 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/plantnutriment/eznutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - if(myseed) +/datum/reagent/plantnutriment/eznutriment/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed)) myseed.adjust_instability(0.2) - myseed.adjust_potency(round(chems.get_reagent_amount(type) * 0.3)) - myseed.adjust_yield(round(chems.get_reagent_amount(type) * 0.1)) + myseed.adjust_potency(round(volume * 0.3)) + myseed.adjust_yield(round(volume * 0.1)) /datum/reagent/plantnutriment/left4zednutriment name = "Left 4 Zed" @@ -1662,12 +1628,10 @@ tox_prob = 13 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/plantnutriment/left4zednutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return +/datum/reagent/plantnutriment/left4zednutriment/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) - mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.1)) - myseed?.adjust_instability(round(chems.get_reagent_amount(type) * 0.2)) + mytray.adjust_plant_health(round(volume * 0.1)) + mytray.myseed?.adjust_instability(round(volume * 0.2)) /datum/reagent/plantnutriment/robustharvestnutriment name = "Robust Harvest" @@ -1676,14 +1640,12 @@ tox_prob = 8 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/plantnutriment/robustharvestnutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - - if(myseed) +/datum/reagent/plantnutriment/robustharvestnutriment/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed)) myseed.adjust_instability(-0.25) - myseed.adjust_potency(round(chems.get_reagent_amount(type) * 0.1)) - myseed.adjust_yield(round(chems.get_reagent_amount(type) * 0.2)) + myseed.adjust_potency(round(volume * 0.1)) + myseed.adjust_yield(round(volume * 0.2)) /datum/reagent/plantnutriment/endurogrow name = "Enduro Grow" @@ -1692,14 +1654,12 @@ tox_prob = 8 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/plantnutriment/endurogrow/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return - - if(myseed) - myseed.adjust_potency(-round(chems.get_reagent_amount(type) * 0.1)) - myseed.adjust_yield(-round(chems.get_reagent_amount(type) * 0.075)) - myseed.adjust_endurance(round(chems.get_reagent_amount(type) * 0.35)) +/datum/reagent/plantnutriment/endurogrow/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed)) + myseed.adjust_potency(-round(volume * 0.1)) + myseed.adjust_yield(-round(volume * 0.075)) + myseed.adjust_endurance(round(volume * 0.35)) /datum/reagent/plantnutriment/liquidearthquake name = "Liquid Earthquake" @@ -1708,14 +1668,13 @@ tox_prob = 13 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/plantnutriment/liquidearthquake/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray) - if(!check_tray(chems, mytray)) - return +/datum/reagent/plantnutriment/liquidearthquake/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) - if(myseed) - myseed.adjust_weed_rate(round(chems.get_reagent_amount(type) * 0.1)) - myseed.adjust_weed_chance(round(chems.get_reagent_amount(type) * 0.3)) - myseed.adjust_production(-round(chems.get_reagent_amount(type) * 0.075)) + var/obj/item/seeds/myseed = mytray.myseed + if(!isnull(myseed)) + myseed.adjust_weed_rate(round(volume * 0.1)) + myseed.adjust_weed_chance(round(volume * 0.3)) + myseed.adjust_production(-round(volume * 0.075)) // GOON OTHERS @@ -2034,11 +1993,8 @@ default_container = /obj/effect/decal/cleanable/ash // Ash is also used IRL in gardening, as a fertilizer enhancer and weed killer -/datum/reagent/ash/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(round(chems.get_reagent_amount(type))) +/datum/reagent/ash/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(round(volume)) mytray.adjust_weedlevel(-1) /datum/reagent/acetone @@ -2206,15 +2162,10 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED // Saltpetre is used for gardening IRL, to simplify highly, it speeds up growth and strengthens plants -/datum/reagent/saltpetre/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - var/salt = chems.get_reagent_amount(type) - mytray.adjust_plant_health(round(salt * 0.18)) - if(myseed) - myseed.adjust_production(-round(salt/10)-prob(salt%10)) - myseed.adjust_potency(round(salt)) +/datum/reagent/saltpetre/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(round(volume * 0.18)) + mytray.myseed?.adjust_production(-round(volume / 10)-prob(volume % 10)) + mytray.myseed?.adjust_potency(round(volume)) /datum/reagent/lye name = "Lye" @@ -2888,14 +2839,11 @@ . = ..() affected_mob.adjustFireLoss((ispodperson(affected_mob) ? -1 : 1) * seconds_per_tick) -/datum/reagent/brimdust/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - +/datum/reagent/brimdust/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) mytray.adjust_weedlevel(-1) mytray.adjust_pestlevel(-1) - mytray.adjust_plant_health(round(chems.get_reagent_amount(type))) - myseed?.adjust_potency(round(chems.get_reagent_amount(type) * 0.5)) + mytray.adjust_plant_health(round(volume)) + mytray.myseed?.adjust_potency(round(volume * 0.5)) // I made this food....with love. // Reagent added to food by chef's with a chef's kiss. Makes people happy. diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 6ffc0be1bf0..0d52ca4e825 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -32,12 +32,9 @@ taste_description = "metal" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - //It has stable IN THE NAME. IT WAS MADE FOR THIS MOMENT. -/datum/reagent/stabilizing_agent/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - myseed?.adjust_instability(-round(chems.get_reagent_amount(type))) +//It has stable IN THE NAME. IT WAS MADE FOR THIS MOMENT. +/datum/reagent/stabilizing_agent/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.myseed?.adjust_instability(-round(volume)) /datum/reagent/clf3 name = "Chlorine Trifluoride" @@ -195,14 +192,11 @@ penetrates_skin = NONE chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - // why, just why -/datum/reagent/napalm/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - if(!(myseed.resistance_flags & FIRE_PROOF)) - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 6)) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 7)) +// why, just why +/datum/reagent/napalm/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + if(!(mytray.myseed?.resistance_flags & FIRE_PROOF)) + mytray.adjust_plant_health(-round(volume * 6)) + mytray.adjust_toxic(round(volume * 7)) mytray.adjust_weedlevel(-rand(5,9)) //At least give them a small reward if they bother. diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index f68b2fc93af..2e256fc6c9c 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -17,11 +17,8 @@ var/health_required = -100 // Are you a bad enough dude to poison your own plants? -/datum/reagent/toxin/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 2)) +/datum/reagent/toxin/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(round(volume * 2)) /datum/reagent/toxin/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) if(toxpwr && affected_mob.health > health_required) @@ -68,12 +65,8 @@ affected_mob.adjustToxLoss(0.5 * seconds_per_tick * REM, required_biotype = affected_biotype) return ..() -/datum/reagent/toxin/mutagen/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - +/datum/reagent/toxin/mutagen/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) mytray.mutation_roll(user) - mytray.adjust_toxic(3) //It is still toxic, mind you, but not to the same degree. #define LIQUID_PLASMA_BP (50+T0C) @@ -353,13 +346,10 @@ ph = 2.7 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - // Plant-B-Gone is just as bad -/datum/reagent/toxin/plantbgone/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 10)) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 6)) +// Plant-B-Gone is just as bad +/datum/reagent/toxin/plantbgone/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 10)) + mytray.adjust_toxic(round(volume * 6)) mytray.adjust_weedlevel(-rand(4,8)) /datum/reagent/toxin/plantbgone/expose_obj(obj/exposed_obj, reac_volume) @@ -398,12 +388,9 @@ ph = 3 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - //Weed Spray -/datum/reagent/toxin/plantbgone/weedkiller/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 0.5)) +//Weed Spray +/datum/reagent/toxin/plantbgone/weedkiller/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(round(volume * 0.5)) mytray.adjust_weedlevel(-rand(1,2)) /datum/reagent/toxin/pestkiller @@ -415,11 +402,8 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED //Pest Spray -/datum/reagent/toxin/pestkiller/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(round(chems.get_reagent_amount(type))) +/datum/reagent/toxin/pestkiller/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(round(volume)) mytray.adjust_pestlevel(-rand(1,2)) /datum/reagent/toxin/pestkiller/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume) @@ -436,11 +420,8 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED //Pest Spray -/datum/reagent/toxin/pestkiller/organic/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 0.1)) +/datum/reagent/toxin/pestkiller/organic/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_toxic(round(volume * 0.1)) mytray.adjust_pestlevel(-rand(1,2)) /datum/reagent/toxin/spore @@ -1067,13 +1048,11 @@ ph = 2.75 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -// ...Why? I mean, clearly someone had to have done this and thought, well, acid doesn't hurt plants, but what brought us here, to this point? -/datum/reagent/toxin/acid/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type))) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 1.5)) +// ...Why? I mean, clearly someone had to have done this and thought, well, +// acid doesn't hurt plants, but what brought us here, to this point? +/datum/reagent/toxin/acid/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume)) + mytray.adjust_toxic(round(volume * 1.5)) mytray.adjust_weedlevel(-rand(1,2)) /datum/reagent/toxin/acid/expose_mob(mob/living/carbon/exposed_carbon, methods=TOUCH, reac_volume) @@ -1115,12 +1094,9 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED // SERIOUSLY -/datum/reagent/toxin/acid/fluacid/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) - if(!check_tray(chems, mytray)) - return - - mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 2)) - mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 3)) +/datum/reagent/toxin/acid/fluacid/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) + mytray.adjust_plant_health(-round(volume * 2)) + mytray.adjust_toxic(round(volume * 3)) mytray.adjust_weedlevel(-rand(1,4)) /datum/reagent/toxin/acid/fluacid/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired)