From eeae6c80e72fcf6ffcfc98474a76e59f3a731d2a Mon Sep 17 00:00:00 2001 From: Rolan7 Date: Thu, 19 Sep 2013 04:51:42 -0400 Subject: [PATCH 1/5] Fixes1404 by changing how hydro trays can receive reagents. Pretty much any reagent container works now, except pills. Food *does* work, it's used as "compost". I might make pills work as compost as well, kinda like those solid Miracle Grow supplements. Issue #1404 was just that plant-b-gone bottles weren't using their reagent contents on hydro trays. Space cleaner spray was similarly not used or checked when cleaning microwaves, so I fixed that extension of the bug. I haven't tested this as thoroughly as I usually test my commits, I'll update this when I'm confident it's all working. I did run through most possibilities though. --- code/game/machinery/kitchen/microwave.dm | 45 ++- code/modules/hydroponics/hydroponics.dm | 331 ++++++++++++----------- 2 files changed, 198 insertions(+), 178 deletions(-) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 3dd751a1911..ce290408845 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -75,24 +75,39 @@ else user << "\red It's broken!" return 1 - else if(src.dirty==100) // The microwave is all dirty so can't be used! - if(istype(O, /obj/item/weapon/reagent_containers/spray/cleaner) || istype(O, /obj/item/weapon/soap/)) // If they're trying to clean it then let them + else if(istype(O, /obj/item/weapon/reagent_containers/spray/)) + var/obj/item/weapon/reagent_containers/spray/clean_spray = O + if(clean_spray.reagents.has_reagent("cleaner",10)) + playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) user.visible_message( \ - "\blue [user] starts to clean the microwave.", \ - "\blue You start to clean the microwave." \ + "\blue [user] has cleaned the microwave.", \ + "\blue You have cleaned the microwave." \ ) - if (do_after(user,20)) - user.visible_message( \ - "\blue [user] has cleaned the microwave.", \ - "\blue You have cleaned the microwave." \ - ) - src.dirty = 0 // It's clean! - src.broken = 0 // just to be sure - src.icon_state = "mw" - src.flags = OPENCONTAINER - else //Otherwise bad luck!! - user << "\red It's dirty!" + src.dirty = 0 // It's clean! + src.broken = 0 // just to be sure + src.icon_state = "mw" + src.flags = OPENCONTAINER + else + user << "\red You need more space cleaner!" return 1 + + else if(istype(O, /obj/item/weapon/soap/)) // If they're trying to clean it then let them + user.visible_message( \ + "\blue [user] starts to clean the microwave.", \ + "\blue You start to clean the microwave." \ + ) + if (do_after(user,20)) + user.visible_message( \ + "\blue [user] has cleaned the microwave.", \ + "\blue You have cleaned the microwave." \ + ) + src.dirty = 0 // It's clean! + src.broken = 0 // just to be sure + src.icon_state = "mw" + src.flags = OPENCONTAINER + else if(src.dirty==100) // The microwave is all dirty so can't be used! + user << "\red It's dirty!" + return 1 else if(is_type_in_list(O,acceptable_items)) if (contents.len>=max_n_of_items) user << "\red This [src] is full of ingredients, you cannot put more." diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 819bbc93a67..8f8f87b75be 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -314,161 +314,176 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) del(O) update_icon() - else if(istype(O, /obj/item/weapon/reagent_containers/syringe)) // Syringe stuff - var/obj/item/weapon/reagent_containers/syringe/S = O + else if(istype(O, /obj/item/weapon/reagent_containers) ) // Syringe stuff (and other reagent containers now too) + var/obj/item/weapon/reagent_containers/reagent_source = O if(planted) - if(S.mode == 1) - if(!S.reagents.total_volume) - user << "\red [S] is empty." + var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() + if(!reagent_source.reagents.total_volume) + user << "\red [reagent_source] is empty." + return + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) + var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source + if(syr.mode != 1) + user << "You can't get any extract out of this plant." return - user << "\red You inject the [myseed.plantname] with a chemical solution." - - //SOON - - // There needs to be a good amount of mutagen to actually work - if(S.reagents.has_reagent("mutagen", 5)) - switch(rand(100)) - if(91 to 100) plantdies() - if(81 to 90) mutatespecie() - if(66 to 80) hardmutate() - if(41 to 65) mutate() - if(21 to 41) user << "The plants don't seem to react..." - if(11 to 20) mutateweed() - if(1 to 10) mutatepest() - else user << "Nothing happens..." - - // Antitoxin binds shit pretty well. So the tox goes significantly down - if(S.reagents.has_reagent("anti_toxin", 1)) - adjustToxic(-round(S.reagents.get_reagent_amount("anti_toxin")*2)) - - // NIGGA, YOU JUST WENT ON FULL RETARD. - if(S.reagents.has_reagent("toxin", 1)) - adjustToxic(round(S.reagents.get_reagent_amount("toxin")*2)) - - // Milk is good for humans, but bad for plants. The sugars canot be used by plants, and the milk fat fucks up growth. Not shrooms though. I can't deal with this now... - if(S.reagents.has_reagent("milk", 1)) - adjustNutri(round(S.reagents.get_reagent_amount("milk")*0.1)) - adjustWater(round(S.reagents.get_reagent_amount("milk")*0.9)) - - // Beer is a chemical composition of alcohol and various other things. It's a shitty nutrient but hey, it's still one. Also alcohol is bad, mmmkay? - if(S.reagents.has_reagent("beer", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("beer")*0.05)) - adjustNutri(round(S.reagents.get_reagent_amount("beer")*0.25)) - adjustWater(round(S.reagents.get_reagent_amount("beer")*0.7)) - - // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("fluorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("fluorine")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("flourine")*2.5)) - adjustWater(-round(S.reagents.get_reagent_amount("flourine")*0.5)) - adjustWeeds(-rand(1,4)) - - // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("chlorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("chlorine")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("chlorine")*1.5)) - adjustWater(-round(S.reagents.get_reagent_amount("chlorine")*0.5)) - adjustWeeds(-rand(1,3)) - - // White Phosphorous + water -> phosphoric acid. That's not a good thing really. 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. - if(S.reagents.has_reagent("phosphorus", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("phosphorus")*0.75)) - adjustNutri(round(S.reagents.get_reagent_amount("phosphorus")*0.1)) - adjustWater(-round(S.reagents.get_reagent_amount("phosphorus")*0.5)) - adjustWeeds(-rand(1,2)) - - // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... - if(S.reagents.has_reagent("sugar", 1)) - adjustWeeds(rand(1,2)) - adjustPests(rand(1,2)) - adjustNutri(round(S.reagents.get_reagent_amount("sugar")*0.1)) - - // It is water! - if(S.reagents.has_reagent("water", 1)) - adjustWater(round(S.reagents.get_reagent_amount("water")*1)) - - // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits~ - if(S.reagents.has_reagent("holywater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("holywater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("holywater")*0.1)) - - // 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. - if(S.reagents.has_reagent("sodawater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("sodawater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("sodawater")*0.1)) - adjustNutri(round(S.reagents.get_reagent_amount("sodawater")*0.1)) - - // Man, you guys are retards - if(S.reagents.has_reagent("sacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("sacid")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("sacid")*1.5)) - adjustWeeds(-rand(1,2)) - - // SERIOUSLY - if(S.reagents.has_reagent("pacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("pacid")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("pacid")*3)) - adjustWeeds(-rand(1,4)) - - // Plant-B-Gone is just as bad - if(S.reagents.has_reagent("plantbgone", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("plantbgone")*2)) - adjustToxic(-round(S.reagents.get_reagent_amount("plantbgone")*3)) - adjustWeeds(-rand(4,8)) - - // Healing - if(S.reagents.has_reagent("cryoxadone", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("cryoxadone")*3)) - adjustToxic(-round(S.reagents.get_reagent_amount("cryoxadone")*3)) - - // Ammonia is bad ass. - if(S.reagents.has_reagent("ammonia", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("ammonia")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("ammonia")*1)) - - // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. - if(S.reagents.has_reagent("diethylamine", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("diethylamine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("diethylamine")*2)) - adjustPests(-rand(1,2)) - - // Compost, effectively - if(S.reagents.has_reagent("nutriment", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("nutriment")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("nutriment")*1)) - - // Poor man's mutagen. - if(S.reagents.has_reagent("radium", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("radium")*1.5)) - adjustToxic(round(S.reagents.get_reagent_amount("radium")*2)) - if(S.reagents.has_reagent("radium", 10)) - switch(rand(100)) - if(91 to 100) plantdies() - if(81 to 90) mutatespecie() - if(66 to 80) hardmutate() - if(41 to 65) mutate() - if(21 to 41) user << "The plants don't seem to react..." - if(11 to 20) mutateweed() - if(1 to 10) mutatepest() - else user << "Nothing happens..." - - // The best stuff there is. For testing/debugging. - if(S.reagents.has_reagent("adminordrazine", 1)) - adjustWater(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustPests(-rand(1,5)) - adjustWeeds(-rand(1,5)) - if(S.reagents.has_reagent("adminordrazine", 5)) - switch(rand(100)) - if(66 to 100) mutatespecie() - if(33 to 65) mutateweed() - if(1 to 32) mutatepest() - else user << "Nothing happens..." - - S.reagents.clear_reagents() + + if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/)) + visible_message("\red [user] uses [reagent_source] as compost.") + del(S) + S = reagent_source else - user << "You can't get any extract out of this plant." + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) + visible_message("\red [user] injects [myseed.plantname] with a chemical solution.") + else if(istype(reagent_source, /obj/item/weapon/reagent_containers/spray/)) + visible_message("\red [src] has been sprayed with [reagent_source] by [user].") + playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) + else if(reagent_source.amount_per_transfer_from_this) // Droppers, cans, beakers, what have you. + visible_message("\red [user] uses [reagent_source] on the [src].") + reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) + + // There needs to be a good amount of mutagen to actually work + if(S.reagents.has_reagent("mutagen", 5)) + switch(rand(100)) + if(91 to 100) plantdies() + if(81 to 90) mutatespecie() + if(66 to 80) hardmutate() + if(41 to 65) mutate() + if(21 to 41) user << "The plants don't seem to react..." + if(11 to 20) mutateweed() + if(1 to 10) mutatepest() + else user << "Nothing happens..." + + // Antitoxin binds shit pretty well. So the tox goes significantly down + if(S.reagents.has_reagent("anti_toxin", 1)) + adjustToxic(-round(S.reagents.get_reagent_amount("anti_toxin")*2)) + + // NIGGA, YOU JUST WENT ON FULL RETARD. + if(S.reagents.has_reagent("toxin", 1)) + adjustToxic(round(S.reagents.get_reagent_amount("toxin")*2)) + + // Milk is good for humans, but bad for plants. The sugars canot be used by plants, and the milk fat fucks up growth. Not shrooms though. I can't deal with this now... + if(S.reagents.has_reagent("milk", 1)) + adjustNutri(round(S.reagents.get_reagent_amount("milk")*0.1)) + adjustWater(round(S.reagents.get_reagent_amount("milk")*0.9)) + + // Beer is a chemical composition of alcohol and various other things. It's a shitty nutrient but hey, it's still one. Also alcohol is bad, mmmkay? + if(S.reagents.has_reagent("beer", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("beer")*0.05)) + adjustNutri(round(S.reagents.get_reagent_amount("beer")*0.25)) + adjustWater(round(S.reagents.get_reagent_amount("beer")*0.7)) + + // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial + if(S.reagents.has_reagent("fluorine", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("fluorine")*2)) + adjustToxic(round(S.reagents.get_reagent_amount("flourine")*2.5)) + adjustWater(-round(S.reagents.get_reagent_amount("flourine")*0.5)) + adjustWeeds(-rand(1,4)) + + // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial + if(S.reagents.has_reagent("chlorine", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("chlorine")*1)) + adjustToxic(round(S.reagents.get_reagent_amount("chlorine")*1.5)) + adjustWater(-round(S.reagents.get_reagent_amount("chlorine")*0.5)) + adjustWeeds(-rand(1,3)) + + // White Phosphorous + water -> phosphoric acid. That's not a good thing really. 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. + if(S.reagents.has_reagent("phosphorus", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("phosphorus")*0.75)) + adjustNutri(round(S.reagents.get_reagent_amount("phosphorus")*0.1)) + adjustWater(-round(S.reagents.get_reagent_amount("phosphorus")*0.5)) + adjustWeeds(-rand(1,2)) + + // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... + if(S.reagents.has_reagent("sugar", 1)) + adjustWeeds(rand(1,2)) + adjustPests(rand(1,2)) + adjustNutri(round(S.reagents.get_reagent_amount("sugar")*0.1)) + + // It is water! + if(S.reagents.has_reagent("water", 1)) + adjustWater(round(S.reagents.get_reagent_amount("water")*1)) + + // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits~ + if(S.reagents.has_reagent("holywater", 1)) + adjustWater(round(S.reagents.get_reagent_amount("holywater")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("holywater")*0.1)) + + // 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. + if(S.reagents.has_reagent("sodawater", 1)) + adjustWater(round(S.reagents.get_reagent_amount("sodawater")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("sodawater")*0.1)) + adjustNutri(round(S.reagents.get_reagent_amount("sodawater")*0.1)) + + // Man, you guys are retards + if(S.reagents.has_reagent("sacid", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("sacid")*1)) + adjustToxic(round(S.reagents.get_reagent_amount("sacid")*1.5)) + adjustWeeds(-rand(1,2)) + + // SERIOUSLY + if(S.reagents.has_reagent("pacid", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("pacid")*2)) + adjustToxic(round(S.reagents.get_reagent_amount("pacid")*3)) + adjustWeeds(-rand(1,4)) + + // Plant-B-Gone is just as bad + if(S.reagents.has_reagent("plantbgone", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("plantbgone")*2)) + adjustToxic(-round(S.reagents.get_reagent_amount("plantbgone")*3)) + adjustWeeds(-rand(4,8)) + + // Healing + if(S.reagents.has_reagent("cryoxadone", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("cryoxadone")*3)) + adjustToxic(-round(S.reagents.get_reagent_amount("cryoxadone")*3)) + + // Ammonia is bad ass. + if(S.reagents.has_reagent("ammonia", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("ammonia")*0.5)) + adjustNutri(round(S.reagents.get_reagent_amount("ammonia")*1)) + + // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. + if(S.reagents.has_reagent("diethylamine", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("diethylamine")*1)) + adjustNutri(round(S.reagents.get_reagent_amount("diethylamine")*2)) + adjustPests(-rand(1,2)) + + // Compost, effectively + if(S.reagents.has_reagent("nutriment", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("nutriment")*0.5)) + adjustNutri(round(S.reagents.get_reagent_amount("nutriment")*1)) + + // Poor man's mutagen. + if(S.reagents.has_reagent("radium", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("radium")*1.5)) + adjustToxic(round(S.reagents.get_reagent_amount("radium")*2)) + if(S.reagents.has_reagent("radium", 10)) + switch(rand(100)) + if(91 to 100) plantdies() + if(81 to 90) mutatespecie() + if(66 to 80) hardmutate() + if(41 to 65) mutate() + if(21 to 41) user << "The plants don't seem to react..." + if(11 to 20) mutateweed() + if(1 to 10) mutatepest() + else user << "Nothing happens..." + + // The best stuff there is. For testing/debugging. + if(S.reagents.has_reagent("adminordrazine", 1)) + adjustWater(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustNutri(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustPests(-rand(1,5)) + adjustWeeds(-rand(1,5)) + if(S.reagents.has_reagent("adminordrazine", 5)) + switch(rand(100)) + if(66 to 100) mutatespecie() + if(33 to 65) mutateweed() + if(1 to 32) mutatepest() + else user << "Nothing happens..." + + S.reagents.clear_reagents() + del(S) else user << "There's nothing to apply the solution into." update_icon() @@ -517,17 +532,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) user << "-Water level: \blue [waterlevel]/100" user << "-Nutrition level: \blue [nutrilevel]/10" user << "" - - else if(istype(O, /obj/item/weapon/reagent_containers/spray/plantbgone)) - if(planted && myseed) - adjustHealth(-rand(5,20)) - adjustPests(-2) - adjustWeeds(-3) - adjustToxic(4)//Oops - visible_message("\red [src] has been sprayed with [O][(user ? " by [user]." : ".")]") - playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) - update_icon() - + else if(istype(O, /obj/item/weapon/minihoe)) if(weedlevel > 0) user.visible_message("\red [user] starts uprooting the weeds.", "\red You remove the weeds from [src].") From 0e758945d5f4dc4ac072c850de13846e4ed0ebd9 Mon Sep 17 00:00:00 2001 From: Rolan7 Date: Fri, 20 Sep 2013 17:15:11 -0400 Subject: [PATCH 2/5] Disables the afterattack for spray bottles and beakers when applied to hydro trays so they don't splash/spray (spray bottles didn't do anything special to blobs). Improved some text. Empty syringe is still ready for extraction code when that gets implemented. Fixed a double-the error. Noticed that hydroponics code is full of them. Cleaned them up. --- code/modules/hydroponics/hydroponics.dm | 25 ++++++++++--------- .../reagents/reagent_containers/glass.dm | 4 +++ .../reagents/reagent_containers/spray.dm | 13 +--------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 8f8f87b75be..90aa9906645 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -310,7 +310,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) adjustNutri(10) yieldmod = myNut.yieldmod mutmod = myNut.mutmod - user << "You replace the nutrient solution in the [src]." + user << "You replace the nutrient solution in [src]." del(O) update_icon() @@ -318,17 +318,18 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) var/obj/item/weapon/reagent_containers/reagent_source = O if(planted) var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() - if(!reagent_source.reagents.total_volume) - user << "\red [reagent_source] is empty." - return + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source if(syr.mode != 1) user << "You can't get any extract out of this plant." return + if(!reagent_source.reagents.total_volume) + user << "\red [reagent_source] is empty." + return - if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/)) - visible_message("\red [user] uses [reagent_source] as compost.") + if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/weapon/reagent_containers/pill)) + visible_message("\red [user] composts [reagent_source], spreading it through the soil.") del(S) S = reagent_source else @@ -338,7 +339,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) visible_message("\red [src] has been sprayed with [reagent_source] by [user].") playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) else if(reagent_source.amount_per_transfer_from_this) // Droppers, cans, beakers, what have you. - visible_message("\red [user] uses [reagent_source] on the [src].") + visible_message("\red [user] uses [reagent_source] on [src].") reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) // There needs to be a good amount of mutagen to actually work @@ -485,7 +486,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) S.reagents.clear_reagents() del(S) else - user << "There's nothing to apply the solution into." + user << "There's no plant in the tray." update_icon() else if( istype(O, /obj/item/seeds/) ) @@ -546,7 +547,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) user.u_equip(O) adjustToxic(myWKiller.toxicity) adjustWeeds(-myWKiller.WeedKillStr) - user << "You apply the weedkiller solution into the [src]." + user << "You apply the weedkiller solution into [src]." playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) del(O) update_icon() @@ -564,7 +565,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) user.u_equip(O) adjustToxic(myPKiller.toxicity) adjustPests(-myPKiller.PestKillStr) - user << "You apply the pestkiller solution into the [src]." + user << "You apply the pestkiller solution into [src]." playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) del(O) update_icon() @@ -602,9 +603,9 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) user << "Water: [waterlevel]/100" user << "Nutrient: [nutrilevel]/10" if(weedlevel >= 5) // Visual aid for those blind - user << "The [src] is filled with weeds!" + user << "[src] is filled with weeds!" if(pestlevel >= 5) // Visual aid for those blind - user << "The [src] is filled with tiny worms!" + user << "[src] is filled with tiny worms!" user << "" // Empty line for readability. /obj/item/seeds/proc/harvest(mob/user = usr) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index e43e45f3a85..8fddc004655 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -90,6 +90,10 @@ //Safety for dumping stuff into a ninja suit. It handles everything through attackby() and this is unnecessary. //gee thanks noize else if(istype(target, /obj/item/clothing/suit/space/space_ninja)) return + + // Hydroponics trays aren't reagent containers, technically. Handled in their attackby. + else if(istype(target, /obj/machinery/hydroponics)) + return else if(reagents.total_volume) user << "You splash the solution onto [target]." diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index c6eef991394..f4fa9c77667 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -17,7 +17,7 @@ /obj/item/weapon/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user as mob) if(istype(A, /obj/item/weapon/storage) || istype(A, /obj/structure/table) || istype(A, /obj/structure/rack) || istype(A, /obj/structure/closet) \ - || istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart)) + || istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/machinery/hydroponics)) return if(istype(A, /obj/effect/proc_holder/spell)) @@ -234,14 +234,3 @@ /obj/item/weapon/reagent_containers/spray/plantbgone/New() ..() reagents.add_reagent("plantbgone", 100) - - -/obj/item/weapon/reagent_containers/spray/plantbgone/afterattack(atom/A as mob|obj, mob/user as mob, proximity) - if(proximity) - if (istype(A, /obj/machinery/hydroponics)) // We are targeting hydrotray - return - - if (istype(A, /obj/effect/blob)) // blob damage in blob code - return - - ..() From 2764694f313c27be4476879a8a76d7289f4c49d7 Mon Sep 17 00:00:00 2001 From: Rolan7 Date: Mon, 23 Sep 2013 22:26:46 -0400 Subject: [PATCH 3/5] Allowed solutions to be applied to empty trays, fixed more text and colors. --- code/game/machinery/kitchen/microwave.dm | 2 + code/modules/hydroponics/hydroponics.dm | 98 +++++++++++++----------- 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index ce290408845..2a23fd83ed1 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -87,6 +87,8 @@ src.broken = 0 // just to be sure src.icon_state = "mw" src.flags = OPENCONTAINER + src.updateUsrDialog() + return 0 // We allow the afterattack proc to generate the spray and noise. Hand-cleaning a microwave with acid should hurt. else user << "\red You need more space cleaner!" return 1 diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 90aa9906645..b16180d10ca 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -22,14 +22,16 @@ var/obj/item/seeds/myseed = null //The currently planted seed /obj/machinery/hydroponics/bullet_act(var/obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables. + if(!planted) + ..() + return if(istype(Proj ,/obj/item/projectile/energy/floramut)) - if(planted) - mutate() + mutate() else if(istype(Proj ,/obj/item/projectile/energy/florayield)) - if(planted && myseed.yield == 0)//Oh god don't divide by zero you'll doom us all. + if(myseed.yield == 0)//Oh god don't divide by zero you'll doom us all. adjustSYield(1) //world << "Yield increased by 1, from 0, to a total of [myseed.yield]" - else if(planted && (prob(1/(myseed.yield * myseed.yield) *100)))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2... + else if(prob(1/(myseed.yield * myseed.yield) *100))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2... adjustSYield(1) //world << "Yield increased by 1, to a total of [myseed.yield]" else @@ -95,10 +97,8 @@ obj/machinery/hydroponics/process() // Plant dies if health <= 0 if(health <= 0) - dead = 1 - harvest = 0 + plantdies() adjustWeeds(1) // Weeds flourish - pestlevel = 0 // Pests die // If the plant is too old, lose health fast if(age > myseed.lifespan) @@ -176,8 +176,12 @@ obj/machinery/hydroponics/update_icon() obj/machinery/hydroponics/proc/weedinvasion() // If a weed growth is sufficient, this happens. dead = 0 + var/oldPlantName if(myseed) // In case there's nothing in the tray beforehand + oldPlantName = myseed.plantname del(myseed) + else + oldPlantName = "Empty tray" switch(rand(1,18)) // randomly pick predominative weed if(16 to 18) myseed = new /obj/item/seeds/reishimycelium @@ -203,11 +207,13 @@ obj/machinery/hydroponics/proc/weedinvasion() // If a weed growth is sufficient, weedlevel = 0 // Reset pestlevel = 0 // Reset update_icon() - visible_message("\blue [src] has been overtaken by [myseed.plantname].") + visible_message("\blue [oldPlantName] overtaken by [myseed.plantname].") obj/machinery/hydroponics/proc/mutate(var/lifemut=2, var/endmut=5, var/productmut=1, var/yieldmut=2, var/potmut=25) // Mutates the current seed + if(!planted) + return adjustSLife(rand(-lifemut,lifemut)) adjustSEnd(rand(-endmut,endmut)) adjustSProduct(rand(-productmut,productmut)) @@ -220,7 +226,10 @@ obj/machinery/hydroponics/proc/hardmutate() obj/machinery/hydroponics/proc/mutatespecie() // Mutagent produced a new plant! - + if(!planted || dead) + return + + var/oldPlantName = myseed.plantname if(myseed.mutatelist.len > 0) var/mutantseed = pick(myseed.mutatelist) del(myseed) @@ -240,13 +249,14 @@ obj/machinery/hydroponics/proc/mutatespecie() // Mutagent produced a new plant! spawn(5) // Wait a while update_icon() - visible_message("\red[src] has suddenly mutated into \blue [myseed.plantname]!") + visible_message("\red[oldPlantName] suddenly mutated into \blue [myseed.plantname]!") obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant if( weedlevel > 5 ) - del(myseed) + if(myseed) + del(myseed) var/newWeed = pick(/obj/item/seeds/libertymycelium, /obj/item/seeds/angelmycelium, /obj/item/seeds/deathnettleseed, /obj/item/seeds/kudzuseed) myseed = new newWeed dead = 0 @@ -268,10 +278,12 @@ obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent in obj/machinery/hydroponics/proc/plantdies() // OH NOES!!!!! I put this all in one function to make things easier health = 0 - dead = 1 harvest = 0 - update_icon() - visible_message("\red[src] is looking very unhealthy!") + pestlevel = 0 // Pests die + if(!dead) + update_icon() + visible_message("\improper\red [myseed.plantname] are looking very unhealthy!") + dead = 1 @@ -289,22 +301,7 @@ obj/machinery/hydroponics/proc/mutatepest() obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) //Called when mob user "attacks" it with object O - if(istype(O, /obj/item/weapon/reagent_containers/glass/bucket)) - var/b_amount = O.reagents.get_reagent_amount("water") - if(b_amount > 0 && waterlevel < 100) - O.reagents.remove_reagent("water", b_amount) - adjustWater(b_amount) - playsound(loc, 'sound/effects/slosh.ogg', 25, 1) - user << "You fill [src] with [b_amount] units of water." - adjustToxic(-round(b_amount/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration. - - else if(waterlevel >= 100) - user << "\red [src] is already full." - else - user << "\red [O] is not filled with water." - update_icon() - - else if(istype(O, /obj/item/nutrient)) + if(istype(O, /obj/item/nutrient)) var/obj/item/nutrient/myNut = O user.u_equip(O) adjustNutri(10) @@ -316,8 +313,12 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else if(istype(O, /obj/item/weapon/reagent_containers) ) // Syringe stuff (and other reagent containers now too) var/obj/item/weapon/reagent_containers/reagent_source = O - if(planted) + if(1) var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() + S.volume = 100 + S.reagents.maximum_volume = 100 + + var/obj/target = myseed ? myseed.plantname : src if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source @@ -325,22 +326,30 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) user << "You can't get any extract out of this plant." return if(!reagent_source.reagents.total_volume) - user << "\red [reagent_source] is empty." + user << "[reagent_source] is empty." return if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/weapon/reagent_containers/pill)) - visible_message("\red [user] composts [reagent_source], spreading it through the soil.") + visible_message("[user] composts [reagent_source], spreading it through [target].") del(S) S = reagent_source else - if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) - visible_message("\red [user] injects [myseed.plantname] with a chemical solution.") + reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe/)) + var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source + visible_message("[user] injects [target] with [syr].") + if(syr.reagents.total_volume <= 0) + syr.mode = 0 + syr.update_icon() else if(istype(reagent_source, /obj/item/weapon/reagent_containers/spray/)) - visible_message("\red [src] has been sprayed with [reagent_source] by [user].") + visible_message("[user] sprays [target] with [reagent_source].") playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) else if(reagent_source.amount_per_transfer_from_this) // Droppers, cans, beakers, what have you. - visible_message("\red [user] uses [reagent_source] on [src].") - reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) + visible_message("[user] uses [reagent_source] on [target].") + + // Beakers, bottles, buckets, etc. Can't use is_open_container though. + if(istype(reagent_source, /obj/item/weapon/reagent_containers/glass/)) + playsound(loc, 'sound/effects/slosh.ogg', 25, 1) // There needs to be a good amount of mutagen to actually work if(S.reagents.has_reagent("mutagen", 5)) @@ -536,11 +545,11 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else if(istype(O, /obj/item/weapon/minihoe)) if(weedlevel > 0) - user.visible_message("\red [user] starts uprooting the weeds.", "\red You remove the weeds from [src].") + user.visible_message("[user] uproots the weeds.", "You remove the weeds from [src].") weedlevel = 0 update_icon() else - user << "\red This plot is completely devoid of weeds. It doesn't need uprooting." + user << "This plot is completely devoid of weeds. It doesn't need uprooting." else if( istype(O, /obj/item/weapon/weedspray) ) var/obj/item/weedkiller/myWKiller = O @@ -820,11 +829,14 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) waterlevel += adjustamt waterlevel = max(waterlevel, 0) waterlevel = min(waterlevel, 100) + if(adjustamt>0) + adjustToxic(-round(adjustamt/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration. /obj/machinery/hydroponics/proc/adjustHealth(var/adjustamt) - health += adjustamt - health = max(health, 0) - health = min(health, myseed.endurance) + if(planted && !dead) + health += adjustamt + health = max(health, 0) + health = min(health, myseed.endurance) /obj/machinery/hydroponics/proc/adjustToxic(var/adjustamt) toxic += adjustamt From f7d271175366cc505aec0ccf895f5aec19323eee Mon Sep 17 00:00:00 2001 From: Rolan7 Date: Tue, 24 Sep 2013 13:37:17 -0400 Subject: [PATCH 4/5] Returns 1 instead of adding (more) special cases to the afterattack functions for beakers and spray bottles. --- code/modules/hydroponics/hydroponics.dm | 356 +++++++++--------- .../reagents/reagent_containers/glass.dm | 4 - .../reagents/reagent_containers/spray.dm | 2 +- 3 files changed, 178 insertions(+), 184 deletions(-) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index b16180d10ca..7c1f8173830 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -313,190 +313,188 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else if(istype(O, /obj/item/weapon/reagent_containers) ) // Syringe stuff (and other reagent containers now too) var/obj/item/weapon/reagent_containers/reagent_source = O - if(1) - var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() - S.volume = 100 - S.reagents.maximum_volume = 100 - - var/obj/target = myseed ? myseed.plantname : src + var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() + S.volume = 100 + S.reagents.maximum_volume = 100 + + var/obj/target = myseed ? myseed.plantname : src - if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) - var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source - if(syr.mode != 1) - user << "You can't get any extract out of this plant." - return - if(!reagent_source.reagents.total_volume) - user << "[reagent_source] is empty." + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe)) + var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source + if(syr.mode != 1) + user << "You can't get any extract out of this plant." return - - if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/weapon/reagent_containers/pill)) - visible_message("[user] composts [reagent_source], spreading it through [target].") - del(S) - S = reagent_source - else - reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) - if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe/)) - var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source - visible_message("[user] injects [target] with [syr].") - if(syr.reagents.total_volume <= 0) - syr.mode = 0 - syr.update_icon() - else if(istype(reagent_source, /obj/item/weapon/reagent_containers/spray/)) - visible_message("[user] sprays [target] with [reagent_source].") - playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) - else if(reagent_source.amount_per_transfer_from_this) // Droppers, cans, beakers, what have you. - visible_message("[user] uses [reagent_source] on [target].") - - // Beakers, bottles, buckets, etc. Can't use is_open_container though. - if(istype(reagent_source, /obj/item/weapon/reagent_containers/glass/)) - playsound(loc, 'sound/effects/slosh.ogg', 25, 1) - - // There needs to be a good amount of mutagen to actually work - if(S.reagents.has_reagent("mutagen", 5)) - switch(rand(100)) - if(91 to 100) plantdies() - if(81 to 90) mutatespecie() - if(66 to 80) hardmutate() - if(41 to 65) mutate() - if(21 to 41) user << "The plants don't seem to react..." - if(11 to 20) mutateweed() - if(1 to 10) mutatepest() - else user << "Nothing happens..." - - // Antitoxin binds shit pretty well. So the tox goes significantly down - if(S.reagents.has_reagent("anti_toxin", 1)) - adjustToxic(-round(S.reagents.get_reagent_amount("anti_toxin")*2)) - - // NIGGA, YOU JUST WENT ON FULL RETARD. - if(S.reagents.has_reagent("toxin", 1)) - adjustToxic(round(S.reagents.get_reagent_amount("toxin")*2)) - - // Milk is good for humans, but bad for plants. The sugars canot be used by plants, and the milk fat fucks up growth. Not shrooms though. I can't deal with this now... - if(S.reagents.has_reagent("milk", 1)) - adjustNutri(round(S.reagents.get_reagent_amount("milk")*0.1)) - adjustWater(round(S.reagents.get_reagent_amount("milk")*0.9)) - - // Beer is a chemical composition of alcohol and various other things. It's a shitty nutrient but hey, it's still one. Also alcohol is bad, mmmkay? - if(S.reagents.has_reagent("beer", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("beer")*0.05)) - adjustNutri(round(S.reagents.get_reagent_amount("beer")*0.25)) - adjustWater(round(S.reagents.get_reagent_amount("beer")*0.7)) - - // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("fluorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("fluorine")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("flourine")*2.5)) - adjustWater(-round(S.reagents.get_reagent_amount("flourine")*0.5)) - adjustWeeds(-rand(1,4)) - - // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("chlorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("chlorine")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("chlorine")*1.5)) - adjustWater(-round(S.reagents.get_reagent_amount("chlorine")*0.5)) - adjustWeeds(-rand(1,3)) - - // White Phosphorous + water -> phosphoric acid. That's not a good thing really. 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. - if(S.reagents.has_reagent("phosphorus", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("phosphorus")*0.75)) - adjustNutri(round(S.reagents.get_reagent_amount("phosphorus")*0.1)) - adjustWater(-round(S.reagents.get_reagent_amount("phosphorus")*0.5)) - adjustWeeds(-rand(1,2)) - - // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... - if(S.reagents.has_reagent("sugar", 1)) - adjustWeeds(rand(1,2)) - adjustPests(rand(1,2)) - adjustNutri(round(S.reagents.get_reagent_amount("sugar")*0.1)) - - // It is water! - if(S.reagents.has_reagent("water", 1)) - adjustWater(round(S.reagents.get_reagent_amount("water")*1)) - - // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits~ - if(S.reagents.has_reagent("holywater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("holywater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("holywater")*0.1)) - - // 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. - if(S.reagents.has_reagent("sodawater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("sodawater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("sodawater")*0.1)) - adjustNutri(round(S.reagents.get_reagent_amount("sodawater")*0.1)) - - // Man, you guys are retards - if(S.reagents.has_reagent("sacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("sacid")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("sacid")*1.5)) - adjustWeeds(-rand(1,2)) - - // SERIOUSLY - if(S.reagents.has_reagent("pacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("pacid")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("pacid")*3)) - adjustWeeds(-rand(1,4)) - - // Plant-B-Gone is just as bad - if(S.reagents.has_reagent("plantbgone", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("plantbgone")*2)) - adjustToxic(-round(S.reagents.get_reagent_amount("plantbgone")*3)) - adjustWeeds(-rand(4,8)) - - // Healing - if(S.reagents.has_reagent("cryoxadone", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("cryoxadone")*3)) - adjustToxic(-round(S.reagents.get_reagent_amount("cryoxadone")*3)) - - // Ammonia is bad ass. - if(S.reagents.has_reagent("ammonia", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("ammonia")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("ammonia")*1)) - - // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. - if(S.reagents.has_reagent("diethylamine", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("diethylamine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("diethylamine")*2)) - adjustPests(-rand(1,2)) - - // Compost, effectively - if(S.reagents.has_reagent("nutriment", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("nutriment")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("nutriment")*1)) - - // Poor man's mutagen. - if(S.reagents.has_reagent("radium", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("radium")*1.5)) - adjustToxic(round(S.reagents.get_reagent_amount("radium")*2)) - if(S.reagents.has_reagent("radium", 10)) - switch(rand(100)) - if(91 to 100) plantdies() - if(81 to 90) mutatespecie() - if(66 to 80) hardmutate() - if(41 to 65) mutate() - if(21 to 41) user << "The plants don't seem to react..." - if(11 to 20) mutateweed() - if(1 to 10) mutatepest() - else user << "Nothing happens..." - - // The best stuff there is. For testing/debugging. - if(S.reagents.has_reagent("adminordrazine", 1)) - adjustWater(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustPests(-rand(1,5)) - adjustWeeds(-rand(1,5)) - if(S.reagents.has_reagent("adminordrazine", 5)) - switch(rand(100)) - if(66 to 100) mutatespecie() - if(33 to 65) mutateweed() - if(1 to 32) mutatepest() - else user << "Nothing happens..." - - S.reagents.clear_reagents() + if(!reagent_source.reagents.total_volume) + user << "[reagent_source] is empty." + return 1 + + if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/weapon/reagent_containers/pill)) + visible_message("[user] composts [reagent_source], spreading it through [target].") del(S) + S = reagent_source else - user << "There's no plant in the tray." + reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) + if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe/)) + var/obj/item/weapon/reagent_containers/syringe/syr = reagent_source + visible_message("[user] injects [target] with [syr].") + if(syr.reagents.total_volume <= 0) + syr.mode = 0 + syr.update_icon() + else if(istype(reagent_source, /obj/item/weapon/reagent_containers/spray/)) + visible_message("[user] sprays [target] with [reagent_source].") + playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) + else if(reagent_source.amount_per_transfer_from_this) // Droppers, cans, beakers, what have you. + visible_message("[user] uses [reagent_source] on [target].") + + // Beakers, bottles, buckets, etc. Can't use is_open_container though. + if(istype(reagent_source, /obj/item/weapon/reagent_containers/glass/)) + playsound(loc, 'sound/effects/slosh.ogg', 25, 1) + + // There needs to be a good amount of mutagen to actually work + if(S.reagents.has_reagent("mutagen", 5)) + switch(rand(100)) + if(91 to 100) plantdies() + if(81 to 90) mutatespecie() + if(66 to 80) hardmutate() + if(41 to 65) mutate() + if(21 to 41) user << "The plants don't seem to react..." + if(11 to 20) mutateweed() + if(1 to 10) mutatepest() + else user << "Nothing happens..." + + // Antitoxin binds shit pretty well. So the tox goes significantly down + if(S.reagents.has_reagent("anti_toxin", 1)) + adjustToxic(-round(S.reagents.get_reagent_amount("anti_toxin")*2)) + + // NIGGA, YOU JUST WENT ON FULL RETARD. + if(S.reagents.has_reagent("toxin", 1)) + adjustToxic(round(S.reagents.get_reagent_amount("toxin")*2)) + + // Milk is good for humans, but bad for plants. The sugars canot be used by plants, and the milk fat fucks up growth. Not shrooms though. I can't deal with this now... + if(S.reagents.has_reagent("milk", 1)) + adjustNutri(round(S.reagents.get_reagent_amount("milk")*0.1)) + adjustWater(round(S.reagents.get_reagent_amount("milk")*0.9)) + + // Beer is a chemical composition of alcohol and various other things. It's a shitty nutrient but hey, it's still one. Also alcohol is bad, mmmkay? + if(S.reagents.has_reagent("beer", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("beer")*0.05)) + adjustNutri(round(S.reagents.get_reagent_amount("beer")*0.25)) + adjustWater(round(S.reagents.get_reagent_amount("beer")*0.7)) + + // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial + if(S.reagents.has_reagent("fluorine", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("fluorine")*2)) + adjustToxic(round(S.reagents.get_reagent_amount("flourine")*2.5)) + adjustWater(-round(S.reagents.get_reagent_amount("flourine")*0.5)) + adjustWeeds(-rand(1,4)) + + // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial + if(S.reagents.has_reagent("chlorine", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("chlorine")*1)) + adjustToxic(round(S.reagents.get_reagent_amount("chlorine")*1.5)) + adjustWater(-round(S.reagents.get_reagent_amount("chlorine")*0.5)) + adjustWeeds(-rand(1,3)) + + // White Phosphorous + water -> phosphoric acid. That's not a good thing really. 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. + if(S.reagents.has_reagent("phosphorus", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("phosphorus")*0.75)) + adjustNutri(round(S.reagents.get_reagent_amount("phosphorus")*0.1)) + adjustWater(-round(S.reagents.get_reagent_amount("phosphorus")*0.5)) + adjustWeeds(-rand(1,2)) + + // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... + if(S.reagents.has_reagent("sugar", 1)) + adjustWeeds(rand(1,2)) + adjustPests(rand(1,2)) + adjustNutri(round(S.reagents.get_reagent_amount("sugar")*0.1)) + + // It is water! + if(S.reagents.has_reagent("water", 1)) + adjustWater(round(S.reagents.get_reagent_amount("water")*1)) + + // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits~ + if(S.reagents.has_reagent("holywater", 1)) + adjustWater(round(S.reagents.get_reagent_amount("holywater")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("holywater")*0.1)) + + // 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. + if(S.reagents.has_reagent("sodawater", 1)) + adjustWater(round(S.reagents.get_reagent_amount("sodawater")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("sodawater")*0.1)) + adjustNutri(round(S.reagents.get_reagent_amount("sodawater")*0.1)) + + // Man, you guys are retards + if(S.reagents.has_reagent("sacid", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("sacid")*1)) + adjustToxic(round(S.reagents.get_reagent_amount("sacid")*1.5)) + adjustWeeds(-rand(1,2)) + + // SERIOUSLY + if(S.reagents.has_reagent("pacid", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("pacid")*2)) + adjustToxic(round(S.reagents.get_reagent_amount("pacid")*3)) + adjustWeeds(-rand(1,4)) + + // Plant-B-Gone is just as bad + if(S.reagents.has_reagent("plantbgone", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("plantbgone")*2)) + adjustToxic(-round(S.reagents.get_reagent_amount("plantbgone")*3)) + adjustWeeds(-rand(4,8)) + + // Healing + if(S.reagents.has_reagent("cryoxadone", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("cryoxadone")*3)) + adjustToxic(-round(S.reagents.get_reagent_amount("cryoxadone")*3)) + + // Ammonia is bad ass. + if(S.reagents.has_reagent("ammonia", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("ammonia")*0.5)) + adjustNutri(round(S.reagents.get_reagent_amount("ammonia")*1)) + + // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. + if(S.reagents.has_reagent("diethylamine", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("diethylamine")*1)) + adjustNutri(round(S.reagents.get_reagent_amount("diethylamine")*2)) + adjustPests(-rand(1,2)) + + // Compost, effectively + if(S.reagents.has_reagent("nutriment", 1)) + adjustHealth(round(S.reagents.get_reagent_amount("nutriment")*0.5)) + adjustNutri(round(S.reagents.get_reagent_amount("nutriment")*1)) + + // Poor man's mutagen. + if(S.reagents.has_reagent("radium", 1)) + adjustHealth(-round(S.reagents.get_reagent_amount("radium")*1.5)) + adjustToxic(round(S.reagents.get_reagent_amount("radium")*2)) + if(S.reagents.has_reagent("radium", 10)) + switch(rand(100)) + if(91 to 100) plantdies() + if(81 to 90) mutatespecie() + if(66 to 80) hardmutate() + if(41 to 65) mutate() + if(21 to 41) user << "The plants don't seem to react..." + if(11 to 20) mutateweed() + if(1 to 10) mutatepest() + else user << "Nothing happens..." + + // The best stuff there is. For testing/debugging. + if(S.reagents.has_reagent("adminordrazine", 1)) + adjustWater(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustHealth(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustNutri(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + adjustPests(-rand(1,5)) + adjustWeeds(-rand(1,5)) + if(S.reagents.has_reagent("adminordrazine", 5)) + switch(rand(100)) + if(66 to 100) mutatespecie() + if(33 to 65) mutateweed() + if(1 to 32) mutatepest() + else user << "Nothing happens..." + + S.reagents.clear_reagents() + del(S) update_icon() + return 1 else if( istype(O, /obj/item/seeds/) ) if(!planted) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 8fddc004655..68964ec3b2a 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -91,10 +91,6 @@ else if(istype(target, /obj/item/clothing/suit/space/space_ninja)) return - // Hydroponics trays aren't reagent containers, technically. Handled in their attackby. - else if(istype(target, /obj/machinery/hydroponics)) - return - else if(reagents.total_volume) user << "You splash the solution onto [target]." reagents.reaction(target, TOUCH) diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index f4fa9c77667..1734f548ccd 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -17,7 +17,7 @@ /obj/item/weapon/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user as mob) if(istype(A, /obj/item/weapon/storage) || istype(A, /obj/structure/table) || istype(A, /obj/structure/rack) || istype(A, /obj/structure/closet) \ - || istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/machinery/hydroponics)) + || istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart)) return if(istype(A, /obj/effect/proc_holder/spell)) From 55f8959e566680c9505554cc242a1d5397bcacb1 Mon Sep 17 00:00:00 2001 From: Rolan7 Date: Fri, 4 Oct 2013 00:27:30 -0400 Subject: [PATCH 5/5] The trans_to proc for /datum/reagents/ now detects and accepts /datum/reagents/ as targets instead of just reagent_containers. Updated the hydroponics attack_by to use that new feature. Improved the microwave-cleaning to use amount_per_transfer_from_this. It does ignore other reagents, only using up space cleaner, because it really doesn't need to be complicated. --- code/game/machinery/kitchen/microwave.dm | 5 +- code/modules/hydroponics/hydroponics.dm | 142 +++++++++++----------- code/modules/reagents/Chemistry-Holder.dm | 10 +- 3 files changed, 81 insertions(+), 76 deletions(-) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 2a23fd83ed1..898e3b1cfb0 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -77,7 +77,8 @@ return 1 else if(istype(O, /obj/item/weapon/reagent_containers/spray/)) var/obj/item/weapon/reagent_containers/spray/clean_spray = O - if(clean_spray.reagents.has_reagent("cleaner",10)) + if(clean_spray.reagents.has_reagent("cleaner",clean_spray.amount_per_transfer_from_this)) + clean_spray.reagents.remove_reagent("cleaner",clean_spray.amount_per_transfer_from_this,1) playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6) user.visible_message( \ "\blue [user] has cleaned the microwave.", \ @@ -88,7 +89,7 @@ src.icon_state = "mw" src.flags = OPENCONTAINER src.updateUsrDialog() - return 0 // We allow the afterattack proc to generate the spray and noise. Hand-cleaning a microwave with acid should hurt. + return 1 // Disables the after-attack so we don't spray the floor/user. else user << "\red You need more space cleaner!" return 1 diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 7c1f8173830..914c06374f3 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -313,9 +313,9 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else if(istype(O, /obj/item/weapon/reagent_containers) ) // Syringe stuff (and other reagent containers now too) var/obj/item/weapon/reagent_containers/reagent_source = O - var/obj/item/weapon/reagent_containers/S = new /obj/item/weapon/reagent_containers() - S.volume = 100 - S.reagents.maximum_volume = 100 + var/datum/reagents/S = new /datum/reagents() + + S.my_atom = src var/obj/target = myseed ? myseed.plantname : src @@ -330,8 +330,8 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) if(istype(reagent_source, /obj/item/weapon/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/weapon/reagent_containers/pill)) visible_message("[user] composts [reagent_source], spreading it through [target].") - del(S) - S = reagent_source + reagent_source.reagents.trans_to(S,reagent_source.reagents.total_volume) + del(reagent_source) else reagent_source.reagents.trans_to(S,reagent_source.amount_per_transfer_from_this) if(istype(reagent_source, /obj/item/weapon/reagent_containers/syringe/)) @@ -351,7 +351,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) // There needs to be a good amount of mutagen to actually work - if(S.reagents.has_reagent("mutagen", 5)) + if(S.has_reagent("mutagen", 5)) switch(rand(100)) if(91 to 100) plantdies() if(81 to 90) mutatespecie() @@ -363,110 +363,110 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else user << "Nothing happens..." // Antitoxin binds shit pretty well. So the tox goes significantly down - if(S.reagents.has_reagent("anti_toxin", 1)) - adjustToxic(-round(S.reagents.get_reagent_amount("anti_toxin")*2)) + if(S.has_reagent("anti_toxin", 1)) + adjustToxic(-round(S.get_reagent_amount("anti_toxin")*2)) // NIGGA, YOU JUST WENT ON FULL RETARD. - if(S.reagents.has_reagent("toxin", 1)) - adjustToxic(round(S.reagents.get_reagent_amount("toxin")*2)) + if(S.has_reagent("toxin", 1)) + adjustToxic(round(S.get_reagent_amount("toxin")*2)) // Milk is good for humans, but bad for plants. The sugars canot be used by plants, and the milk fat fucks up growth. Not shrooms though. I can't deal with this now... - if(S.reagents.has_reagent("milk", 1)) - adjustNutri(round(S.reagents.get_reagent_amount("milk")*0.1)) - adjustWater(round(S.reagents.get_reagent_amount("milk")*0.9)) + if(S.has_reagent("milk", 1)) + adjustNutri(round(S.get_reagent_amount("milk")*0.1)) + adjustWater(round(S.get_reagent_amount("milk")*0.9)) // Beer is a chemical composition of alcohol and various other things. It's a shitty nutrient but hey, it's still one. Also alcohol is bad, mmmkay? - if(S.reagents.has_reagent("beer", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("beer")*0.05)) - adjustNutri(round(S.reagents.get_reagent_amount("beer")*0.25)) - adjustWater(round(S.reagents.get_reagent_amount("beer")*0.7)) + if(S.has_reagent("beer", 1)) + adjustHealth(-round(S.get_reagent_amount("beer")*0.05)) + adjustNutri(round(S.get_reagent_amount("beer")*0.25)) + adjustWater(round(S.get_reagent_amount("beer")*0.7)) // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("fluorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("fluorine")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("flourine")*2.5)) - adjustWater(-round(S.reagents.get_reagent_amount("flourine")*0.5)) + if(S.has_reagent("fluorine", 1)) + adjustHealth(-round(S.get_reagent_amount("fluorine")*2)) + adjustToxic(round(S.get_reagent_amount("flourine")*2.5)) + adjustWater(-round(S.get_reagent_amount("flourine")*0.5)) adjustWeeds(-rand(1,4)) // You're an idiot for thinking that one of the most corrosive and deadly gasses would be beneficial - if(S.reagents.has_reagent("chlorine", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("chlorine")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("chlorine")*1.5)) - adjustWater(-round(S.reagents.get_reagent_amount("chlorine")*0.5)) + if(S.has_reagent("chlorine", 1)) + adjustHealth(-round(S.get_reagent_amount("chlorine")*1)) + adjustToxic(round(S.get_reagent_amount("chlorine")*1.5)) + adjustWater(-round(S.get_reagent_amount("chlorine")*0.5)) adjustWeeds(-rand(1,3)) // White Phosphorous + water -> phosphoric acid. That's not a good thing really. 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. - if(S.reagents.has_reagent("phosphorus", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("phosphorus")*0.75)) - adjustNutri(round(S.reagents.get_reagent_amount("phosphorus")*0.1)) - adjustWater(-round(S.reagents.get_reagent_amount("phosphorus")*0.5)) + if(S.has_reagent("phosphorus", 1)) + adjustHealth(-round(S.get_reagent_amount("phosphorus")*0.75)) + adjustNutri(round(S.get_reagent_amount("phosphorus")*0.1)) + adjustWater(-round(S.get_reagent_amount("phosphorus")*0.5)) adjustWeeds(-rand(1,2)) // Plants should not have sugar, they can't use it and it prevents them getting water/ nutients, it is good for mold though... - if(S.reagents.has_reagent("sugar", 1)) + if(S.has_reagent("sugar", 1)) adjustWeeds(rand(1,2)) adjustPests(rand(1,2)) - adjustNutri(round(S.reagents.get_reagent_amount("sugar")*0.1)) + adjustNutri(round(S.get_reagent_amount("sugar")*0.1)) // It is water! - if(S.reagents.has_reagent("water", 1)) - adjustWater(round(S.reagents.get_reagent_amount("water")*1)) + if(S.has_reagent("water", 1)) + adjustWater(round(S.get_reagent_amount("water")*1)) // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits~ - if(S.reagents.has_reagent("holywater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("holywater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("holywater")*0.1)) + if(S.has_reagent("holywater", 1)) + adjustWater(round(S.get_reagent_amount("holywater")*1)) + adjustHealth(round(S.get_reagent_amount("holywater")*0.1)) // 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. - if(S.reagents.has_reagent("sodawater", 1)) - adjustWater(round(S.reagents.get_reagent_amount("sodawater")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("sodawater")*0.1)) - adjustNutri(round(S.reagents.get_reagent_amount("sodawater")*0.1)) + if(S.has_reagent("sodawater", 1)) + adjustWater(round(S.get_reagent_amount("sodawater")*1)) + adjustHealth(round(S.get_reagent_amount("sodawater")*0.1)) + adjustNutri(round(S.get_reagent_amount("sodawater")*0.1)) // Man, you guys are retards - if(S.reagents.has_reagent("sacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("sacid")*1)) - adjustToxic(round(S.reagents.get_reagent_amount("sacid")*1.5)) + if(S.has_reagent("sacid", 1)) + adjustHealth(-round(S.get_reagent_amount("sacid")*1)) + adjustToxic(round(S.get_reagent_amount("sacid")*1.5)) adjustWeeds(-rand(1,2)) // SERIOUSLY - if(S.reagents.has_reagent("pacid", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("pacid")*2)) - adjustToxic(round(S.reagents.get_reagent_amount("pacid")*3)) + if(S.has_reagent("pacid", 1)) + adjustHealth(-round(S.get_reagent_amount("pacid")*2)) + adjustToxic(round(S.get_reagent_amount("pacid")*3)) adjustWeeds(-rand(1,4)) // Plant-B-Gone is just as bad - if(S.reagents.has_reagent("plantbgone", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("plantbgone")*2)) - adjustToxic(-round(S.reagents.get_reagent_amount("plantbgone")*3)) + if(S.has_reagent("plantbgone", 1)) + adjustHealth(-round(S.get_reagent_amount("plantbgone")*2)) + adjustToxic(-round(S.get_reagent_amount("plantbgone")*3)) adjustWeeds(-rand(4,8)) // Healing - if(S.reagents.has_reagent("cryoxadone", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("cryoxadone")*3)) - adjustToxic(-round(S.reagents.get_reagent_amount("cryoxadone")*3)) + if(S.has_reagent("cryoxadone", 1)) + adjustHealth(round(S.get_reagent_amount("cryoxadone")*3)) + adjustToxic(-round(S.get_reagent_amount("cryoxadone")*3)) // Ammonia is bad ass. - if(S.reagents.has_reagent("ammonia", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("ammonia")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("ammonia")*1)) + if(S.has_reagent("ammonia", 1)) + adjustHealth(round(S.get_reagent_amount("ammonia")*0.5)) + adjustNutri(round(S.get_reagent_amount("ammonia")*1)) // This is more bad ass, and pests get hurt by the corrosive nature of it, not the plant. - if(S.reagents.has_reagent("diethylamine", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("diethylamine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("diethylamine")*2)) + if(S.has_reagent("diethylamine", 1)) + adjustHealth(round(S.get_reagent_amount("diethylamine")*1)) + adjustNutri(round(S.get_reagent_amount("diethylamine")*2)) adjustPests(-rand(1,2)) // Compost, effectively - if(S.reagents.has_reagent("nutriment", 1)) - adjustHealth(round(S.reagents.get_reagent_amount("nutriment")*0.5)) - adjustNutri(round(S.reagents.get_reagent_amount("nutriment")*1)) + if(S.has_reagent("nutriment", 1)) + adjustHealth(round(S.get_reagent_amount("nutriment")*0.5)) + adjustNutri(round(S.get_reagent_amount("nutriment")*1)) // Poor man's mutagen. - if(S.reagents.has_reagent("radium", 1)) - adjustHealth(-round(S.reagents.get_reagent_amount("radium")*1.5)) - adjustToxic(round(S.reagents.get_reagent_amount("radium")*2)) - if(S.reagents.has_reagent("radium", 10)) + if(S.has_reagent("radium", 1)) + adjustHealth(-round(S.get_reagent_amount("radium")*1.5)) + adjustToxic(round(S.get_reagent_amount("radium")*2)) + if(S.has_reagent("radium", 10)) switch(rand(100)) if(91 to 100) plantdies() if(81 to 90) mutatespecie() @@ -478,20 +478,20 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else user << "Nothing happens..." // The best stuff there is. For testing/debugging. - if(S.reagents.has_reagent("adminordrazine", 1)) - adjustWater(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustHealth(round(S.reagents.get_reagent_amount("adminordrazine")*1)) - adjustNutri(round(S.reagents.get_reagent_amount("adminordrazine")*1)) + if(S.has_reagent("adminordrazine", 1)) + adjustWater(round(S.get_reagent_amount("adminordrazine")*1)) + adjustHealth(round(S.get_reagent_amount("adminordrazine")*1)) + adjustNutri(round(S.get_reagent_amount("adminordrazine")*1)) adjustPests(-rand(1,5)) adjustWeeds(-rand(1,5)) - if(S.reagents.has_reagent("adminordrazine", 5)) + if(S.has_reagent("adminordrazine", 5)) switch(rand(100)) if(66 to 100) mutatespecie() if(33 to 65) mutateweed() if(1 to 32) mutatepest() else user << "Nothing happens..." - S.reagents.clear_reagents() + S.clear_reagents() del(S) update_icon() return 1 diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 0e0219ea259..4ee36b9f107 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -95,9 +95,13 @@ datum trans_to(var/obj/target, var/amount=1, var/multiplier=1, var/preserve_data=1)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. if (!target ) return - if (!target.reagents || src.total_volume<=0) - return - var/datum/reagents/R = target.reagents + var/datum/reagents/R + if(istype(target,/datum/reagents/)) + R = target + else + if (!target.reagents || src.total_volume<=0) + return + R = target.reagents amount = min(min(amount, src.total_volume), R.maximum_volume-R.total_volume) var/part = amount / src.total_volume var/trans_data = null