From 6388c3cf55b72cb41fbaf7c79479dd0a65a1b0e5 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 4 Jan 2021 23:43:33 +0200 Subject: [PATCH 1/5] Blood bag delays --- .../reagents/reagent_containers/blood_pack.dm | 57 +++++++++++-------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 98a117ea69..efbb3ac826 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -104,31 +104,42 @@ return ..() /obj/item/reagent_containers/blood/attack(mob/living/carbon/C, mob/user, def_zone) - if(user.a_intent == INTENT_HELP && reagents.total_volume > 0 && iscarbon(C) && user.a_intent == INTENT_HELP) - if(C.is_mouth_covered()) - to_chat(user, "You cant drink from the [src] while your mouth is covered.") - return - if(user != C) - user.visible_message("[user] forces [C] to drink from the [src].", \ - "You force [C] to drink from the [src]") - if(!do_mob(user, C, 50)) - return - else - if(!do_mob(user, C, 10)) - return + if(!iscarbon(C) || !user.a_intent == INTENT_HELP || reagents.total_volume < 0) + ..() - to_chat(user, "You take a sip from the [src].") - user.visible_message("[user] puts the [src] up to their mouth.") - if(reagents.total_volume <= 0) // Safety: In case you spam clicked the blood bag on yourself, and it is now empty (below will divide by zero) - return - var/gulp_size = 3 - var/fraction = min(gulp_size / reagents.total_volume, 1) - reagents.reaction(C, INGEST, fraction) //checkLiked(fraction, M) // Blood isn't food, sorry. - reagents.trans_to(C, gulp_size) - reagents.remove_reagent(src, 2) //Inneficency, so hey, IVs are usefull. - playsound(C.loc,'sound/items/drink.ogg', rand(10, 50), TRUE) + if(C.is_mouth_covered()) + to_chat(user, "You can't drink from the [src] while your mouth is covered.") return - ..() + + if(!user.CheckActionCooldown()) + to_chat(user, "You can't drink from the [src] so fast!") + return + if(user != C) + user.visible_message("[user] forces [C] to drink from the [src].", \ + "You force [C] to drink from the [src]") + user.DelayNextAction(50) + if(do_mob(user, C, 50)) + do_drink(C, user) + + else + user.DelayNextAction(10) + if(do_mob(user, C, 10)) + user.visible_message("[user] puts the [src] up to their mouth.", \ + "You take a sip from the [src].") + do_drink(C, user) + + +/obj/item/reagent_containers/blood/proc/do_drink(mob/living/carbon/C, mob/user) + if(reagents.total_volume <= 0) // Safety: In case you spam clicked the blood bag on yourself, and it is now empty (below will divide by zero) + to_chat(user, "...and notice [src] is empty.") + return + var/gulp_size = 3 + var/fraction = min(gulp_size / reagents.total_volume, 1) + reagents.reaction(C, INGEST, fraction) //checkLiked(fraction, M) // Blood isn't food, sorry. + reagents.trans_to(C, gulp_size) + reagents.remove_reagent(src, 2) //Inneficency, so hey, IVs are usefull. + playsound(C.loc,'sound/items/drink.ogg', rand(10, 50), TRUE) + /obj/item/reagent_containers/blood/bluespace name = "bluespace blood pack" From ffe20839fe92de3e97936b8b633938a2a4900260 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 4 Jan 2021 23:46:48 +0200 Subject: [PATCH 2/5] tweaks loss numbers --- code/modules/reagents/reagent_containers/blood_pack.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index efbb3ac826..3c7bf733a6 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -137,7 +137,7 @@ var/fraction = min(gulp_size / reagents.total_volume, 1) reagents.reaction(C, INGEST, fraction) //checkLiked(fraction, M) // Blood isn't food, sorry. reagents.trans_to(C, gulp_size) - reagents.remove_reagent(src, 2) //Inneficency, so hey, IVs are usefull. + reagents.remove_reagent(src, 5) //Inneficency, so hey, IVs are usefull. playsound(C.loc,'sound/items/drink.ogg', rand(10, 50), TRUE) From df825b4441a20f79000cb4a69484cf3186a089ce Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 12 Jan 2021 00:23:39 +0200 Subject: [PATCH 3/5] deltafire's suggested fixes --- code/modules/reagents/reagent_containers/blood_pack.dm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 3c7bf733a6..842ed71e90 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -104,15 +104,17 @@ return ..() /obj/item/reagent_containers/blood/attack(mob/living/carbon/C, mob/user, def_zone) - if(!iscarbon(C) || !user.a_intent == INTENT_HELP || reagents.total_volume < 0) + if(!iscarbon(C) || !user.a_intent != INTENT_HELP || reagents.total_volume < 0) ..() if(C.is_mouth_covered()) + if(user != C) + to_chat(user, "You can't drink force [C] to drink from [src] while their mouth is covered.") + return to_chat(user, "You can't drink from the [src] while your mouth is covered.") return if(!user.CheckActionCooldown()) - to_chat(user, "You can't drink from the [src] so fast!") return if(user != C) user.visible_message("[user] forces [C] to drink from the [src].", \ @@ -136,8 +138,8 @@ var/gulp_size = 3 var/fraction = min(gulp_size / reagents.total_volume, 1) reagents.reaction(C, INGEST, fraction) //checkLiked(fraction, M) // Blood isn't food, sorry. + reagents.remove_any(5) //Inneficency, so hey, IVs are usefull. reagents.trans_to(C, gulp_size) - reagents.remove_reagent(src, 5) //Inneficency, so hey, IVs are usefull. playsound(C.loc,'sound/items/drink.ogg', rand(10, 50), TRUE) From 19f27f2f5998f94aecbfe28b673321409e11dcbe Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 14 Jan 2021 10:57:46 +0200 Subject: [PATCH 4/5] Somehow forgot this very important detail --- code/modules/reagents/reagent_containers/blood_pack.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 842ed71e90..de3db8a4fd 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -104,7 +104,7 @@ return ..() /obj/item/reagent_containers/blood/attack(mob/living/carbon/C, mob/user, def_zone) - if(!iscarbon(C) || !user.a_intent != INTENT_HELP || reagents.total_volume < 0) + if(!iscarbon(C) || user.a_intent != INTENT_HELP || reagents.total_volume <= 0) ..() if(C.is_mouth_covered()) From cc4c3533b7331843245cf5cfbd92c8f5f70e8792 Mon Sep 17 00:00:00 2001 From: Arturlang Date: Wed, 20 Jan 2021 02:25:22 +0200 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: DeltaFire <46569814+DeltaFire15@users.noreply.github.com> --- .../reagents/reagent_containers/blood_pack.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index de3db8a4fd..acfda85963 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -109,16 +109,16 @@ if(C.is_mouth_covered()) if(user != C) - to_chat(user, "You can't drink force [C] to drink from [src] while their mouth is covered.") + to_chat(user, "You can't force [C] to drink from [src] while their mouth is covered.") return - to_chat(user, "You can't drink from the [src] while your mouth is covered.") + to_chat(user, "You can't drink from [src] while your mouth is covered.") return if(!user.CheckActionCooldown()) return if(user != C) - user.visible_message("[user] forces [C] to drink from the [src].", \ - "You force [C] to drink from the [src]") + user.visible_message("[user] forces [C] to drink from [src].", \ + "You force [C] to drink from [src]") user.DelayNextAction(50) if(do_mob(user, C, 50)) do_drink(C, user) @@ -126,8 +126,8 @@ else user.DelayNextAction(10) if(do_mob(user, C, 10)) - user.visible_message("[user] puts the [src] up to their mouth.", \ - "You take a sip from the [src].") + user.visible_message("[user] puts [src] up to their mouth.", \ + "You take a sip from [src].") do_drink(C, user)