From 39305b1a866fea7c4eeba9250f84550c23d3c386 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Tue, 30 Jun 2015 09:27:06 -0400 Subject: [PATCH] Food/Pill Fixes Fixes Food and Pills so that they actually transfer their reagents properly - Big thanks to Krausus for helping with locating and correcting the issue Fixes IPCs being able to eat pills. - They have a monitor for a head, where do you think you're going to put that? Fixes IPCs being immune to the soothing effects of water - IPCs that are on fire can be properly doused with a splashing of water. --- code/modules/reagents/Chemistry-Holder.dm | 34 ++++--------------- code/modules/reagents/Chemistry-Reagents.dm | 3 +- .../reagent_containers/food/condiment.dm | 4 +-- .../reagent_containers/food/drinks.dm | 4 +-- .../reagent_containers/food/snacks.dm | 2 +- .../reagents/reagent_containers/pill.dm | 29 +++++++++++----- 6 files changed, 33 insertions(+), 43 deletions(-) diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 91392283ac5..b96939ac697 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -127,32 +127,6 @@ datum if (!target.reagents || src.total_volume<=0) return - /*var/datum/reagents/R = target.reagents - - var/obj/item/weapon/reagent_containers/glass/beaker/noreact/B = new /obj/item/weapon/reagent_containers/glass/beaker/noreact //temporary holder - - amount = min(min(amount, src.total_volume), R.maximum_volume-R.total_volume) - var/part = amount / src.total_volume - var/trans_data = null - for (var/datum/reagent/current_reagent in src.reagent_list) - if (!current_reagent) - continue - //if (current_reagent.id == "blood" && ishuman(target)) - // var/mob/living/carbon/human/H = target - // H.inject_blood(my_atom, amount) - // continue - var/current_reagent_transfer = current_reagent.volume * part - if(preserve_data) - trans_data = current_reagent.data - - B.add_reagent(current_reagent.id, (current_reagent_transfer * multiplier), trans_data, safety = 1) //safety checks on these so all chemicals are transferred - src.remove_reagent(current_reagent.id, current_reagent_transfer, safety = 1) // to the target container before handling reactions - - src.update_total() - B.update_total() - B.handle_reactions() - src.handle_reactions()*/ - var/obj/item/weapon/reagent_containers/glass/beaker/noreact/B = new /obj/item/weapon/reagent_containers/glass/beaker/noreact //temporary holder B.volume = 1000 @@ -163,9 +137,13 @@ datum src.trans_to(B, amount) - spawn(100) + spawn(-1) + src = null // Survive through deletion of the reagent holder + sleep(100) + if(!target) + return BR.trans_to(target, BR.total_volume) - del(B) + qdel(B) return amount diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index fab92027cc9..ef6d0f4437e 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -234,6 +234,7 @@ datum reagent_state = LIQUID color = "#0064C8" // rgb: 0, 100, 200 var/cooling_temperature = 2 + process_flags = ORGANIC | SYNTHETIC reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume) if(!istype(M, /mob/living)) @@ -3238,4 +3239,4 @@ datum holder.reagent_list -= src holder = null - return ..() + return ..() diff --git a/code/modules/reagents/reagent_containers/food/condiment.dm b/code/modules/reagents/reagent_containers/food/condiment.dm index 948d6abff88..49316a33e92 100644 --- a/code/modules/reagents/reagent_containers/food/condiment.dm +++ b/code/modules/reagents/reagent_containers/food/condiment.dm @@ -35,7 +35,7 @@ M << "\blue You swallow some of contents of the [src]." if(reagents.total_volume) reagents.reaction(M, INGEST) - spawn(5) + spawn(0) reagents.trans_to_ingest(M, 10) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) @@ -59,7 +59,7 @@ if(reagents.total_volume) reagents.reaction(M, INGEST) - spawn(5) + spawn(0) reagents.trans_to(M, 10) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index bc2e1e5dc27..15f585051e6 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -37,7 +37,7 @@ M << "\blue You swallow a gulp of [src]." if(reagents.total_volume) reagents.reaction(M, INGEST) - spawn(5) + spawn(0) reagents.trans_to_ingest(M, gulp_size) playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) @@ -65,7 +65,7 @@ if(reagents.total_volume) reagents.reaction(M, INGEST) - spawn(5) + spawn(0) reagents.trans_to_ingest(M, gulp_size) if(isrobot(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index be5d513e42e..11367d61787 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -100,7 +100,7 @@ playsound(M.loc,'sound/items/eatfood.ogg', rand(10,50), 1) if(reagents.total_volume) reagents.reaction(M, INGEST) - spawn(5) + spawn(0) if(reagents.total_volume > bitesize) /* * I totally cannot understand what this code supposed to do. diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index d8800ae3a1e..8ba0779b746 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -21,12 +21,18 @@ return attack(mob/M as mob, mob/user as mob, def_zone) if(M == user) - M << "\blue You [apply_method] [src]." + if(istype(M,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = M + if(H.species.flags & IS_SYNTHETIC) + H << "You have a monitor for a head, where do you think you're going to put that?" + return + + M << "You [apply_method] [src]." M.unEquip(src) //icon update if(reagents.total_volume) reagents.reaction(M, apply_type) - spawn(5) - reagents.trans_to(M, reagents.total_volume) + spawn(0) + reagents.trans_to_ingest(M, reagents.total_volume) qdel(src) else qdel(src) @@ -34,14 +40,19 @@ else if(istype(M, /mob/living/carbon/human) ) + var/mob/living/carbon/human/H = M + if(H.species.flags & IS_SYNTHETIC) + user << "They have a monitor for a head, where do you think you're going to put that?" + return + for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] attempts to force [M] to [apply_method] [src].", 1) + O.show_message("[user] attempts to force [M] to [apply_method] [src].", 1) if(!do_mob(user, M)) return user.unEquip(src) //icon update for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] forces [M] to [apply_method] [src].", 1) + O.show_message("[user] forces [M] to [apply_method] [src].", 1) M.attack_log += text("\[[time_stamp()]\] Has been fed [src.name] by [user.name] ([user.ckey]) Reagents: [reagentlist(src)]") user.attack_log += text("\[[time_stamp()]\] Fed [M.name] by [M.name] ([M.ckey]) Reagents: [reagentlist(src)]") @@ -54,7 +65,7 @@ if(reagents.total_volume) reagents.reaction(M, apply_type) - spawn(5) + spawn(0) reagents.trans_to_ingest(M, reagents.total_volume) qdel(src) else @@ -69,7 +80,7 @@ if(target.is_open_container() != 0 && target.reagents) if(!target.reagents.total_volume) - user << "\red [target] is empty. Cant dissolve [src]." + user << "[target] is empty. Cant dissolve [src]." return // /vg/: Logging transfers of bad things @@ -83,10 +94,10 @@ message_admins("[user.name] ([user.ckey]) added [reagents.get_reagent_ids(1)] to \a [target] with [src].[hl] (JMP)") log_game("[user.name] ([user.ckey]) added [reagents.get_reagent_ids(1)] to \a [target] with [src].") - user << "\blue You dissolve [src] in [target]" + user << "You dissolve [src] in [target]." reagents.trans_to(target, reagents.total_volume) for(var/mob/O in viewers(2, user)) - O.show_message("\red [user] puts something in [target].", 1) + O.show_message("[user] puts something in [target].", 1) spawn(5) qdel(src)