From b1bfbf346d8a0abd3d151f69eb6590104407c902 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 11 May 2015 22:17:24 -0400 Subject: [PATCH 1/2] Snacks, drinks, and pills now check mouth coverage Mouth coverage is defined somewhat conservatively so that breath masks and the like do not prevent eating. In general only things that completely cover your face or head like gasmasks and space suit helmets block eating and drinking, or forcing the same on someone. --- .../mob/living/carbon/human/human_defense.dm | 8 ++++++++ .../reagents/reagent_containers/food/drinks.dm | 12 +++++++++++- .../reagents/reagent_containers/food/snacks.dm | 13 ++++++++++++- code/modules/reagents/reagent_containers/pill.dm | 12 +++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index a0c78d7572..1f50fb83f5 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -138,6 +138,14 @@ emp_act return 1 return 0 +//Used to check if they can be fed food/drinks/pills +/mob/living/carbon/human/proc/check_mouth_coverage() + var/list/protective_gear = list(head, wear_mask, wear_suit, w_uniform) + for(var/obj/item/gear in protective_gear) + if(istype(gear) && (gear.body_parts_covered & FACE) && (gear.flags & (MASKCOVERSMOUTH|HEADCOVERSMOUTH))) + return gear + return null + /mob/living/carbon/human/proc/check_shields(var/damage = 0, var/attack_text = "the attack") if(l_hand && istype(l_hand, /obj/item/weapon))//Current base is the prob(50-d/3) var/obj/item/weapon/I = l_hand diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index 58b11a61ac..161dbee93c 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -33,6 +33,11 @@ if(H.species.flags & IS_SYNTHETIC) H << "\red You have a monitor for a head, where do you think you're going to put that?" return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" + return M << "\blue You swallow a gulp from \the [src]." if(reagents.total_volume) @@ -44,7 +49,12 @@ var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "\red They have a monitor for a head, where do you think you're going to put that?" + return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" return for(var/mob/O in viewers(world.view, user)) diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 3af092f0cc..8a8213576b 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -49,6 +49,12 @@ if(H.species.flags & IS_SYNTHETIC) H << "\red You have a monitor for a head, where do you think you're going to put that?" return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" + return + if (fullness <= 50) M << "\red You hungrily chew out a piece of [src] and gobble it!" if (fullness > 50 && fullness <= 150) @@ -64,7 +70,12 @@ if(istype(M,/mob/living/carbon/human)) var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "\red They have a monitor for a head, where do you think you're going to put that?" + return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" return if(!istype(M, /mob/living/carbon/slime)) //If you're feeding it to someone else. diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index d0f678ddd9..c5bb2a0795 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -26,6 +26,11 @@ if(H.species.flags & IS_SYNTHETIC) H << "\red You have a monitor for a head, where do you think you're going to put that?" return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" + return M << "\blue You swallow [src]." M.drop_from_inventory(src) //icon update @@ -40,7 +45,12 @@ var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "\red They have a monitor for a head, where do you think you're going to put that?" + return + + var/obj/item/blocked = H.check_mouth_coverage() + if(blocked) + user << "\The [blocked] is in the way!" return for(var/mob/O in viewers(world.view, user)) From b721eb36ef272109368785d520981552ed4963ef Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 11 May 2015 23:33:21 -0400 Subject: [PATCH 2/2] Span classes and visible_message(), changelog --- .../reagent_containers/food/drinks.dm | 14 +++++------ .../reagent_containers/food/snacks.dm | 25 ++++++++----------- .../reagents/reagent_containers/pill.dm | 12 ++++----- html/changelogs/HarpyEagle-fooddrinkpill.yml | 7 ++++++ 4 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 html/changelogs/HarpyEagle-fooddrinkpill.yml diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index 161dbee93c..8681503304 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -23,7 +23,7 @@ var/fillevel = gulp_size if(!R.total_volume || !R) - user << "\red The [src.name] is empty!" + user << "The [src.name] is empty!" return 0 if(M == user) @@ -31,7 +31,7 @@ if(istype(M,/mob/living/carbon/human)) var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red You have a monitor for a head, where do you think you're going to put that?" + H << "You have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -39,7 +39,7 @@ user << "\The [blocked] is in the way!" return - M << "\blue You swallow a gulp from \the [src]." + M << "You swallow a gulp from \the [src]." if(reagents.total_volume) reagents.trans_to_ingest(M, gulp_size) @@ -49,7 +49,7 @@ var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - user << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "They have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -57,11 +57,9 @@ user << "\The [blocked] is in the way!" return - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] attempts to feed [M] [src].", 1) + user.visible_message("[user] attempts to feed [M] [src].") if(!do_mob(user, M)) return - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] feeds [M] [src].", 1) + user.visible_message("[user] feeds [M] [src].") 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)]") diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 8a8213576b..faeb25ba60 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -47,7 +47,7 @@ if(istype(M,/mob/living/carbon/human)) var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red You have a monitor for a head, where do you think you're going to put that?" + H << "You have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -56,21 +56,21 @@ return if (fullness <= 50) - M << "\red You hungrily chew out a piece of [src] and gobble it!" + M << "You hungrily chew out a piece of [src] and gobble it!" if (fullness > 50 && fullness <= 150) - M << "\blue You hungrily begin to eat [src]." + M << "You hungrily begin to eat [src]." if (fullness > 150 && fullness <= 350) - M << "\blue You take a bite of [src]." + M << "You take a bite of [src]." if (fullness > 350 && fullness <= 550) - M << "\blue You unwillingly chew a bit of [src]." + M << "You unwillingly chew a bit of [src]." if (fullness > (550 * (1 + M.overeatduration / 2000))) // The more you eat - the more you can eat - M << "\red You cannot force any more of [src] to go down your throat." + M << "You cannot force any more of [src] to go down your throat." return 0 else if(istype(M,/mob/living/carbon/human)) var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - user << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "They have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -81,12 +81,10 @@ if(!istype(M, /mob/living/carbon/slime)) //If you're feeding it to someone else. if (fullness <= (550 * (1 + M.overeatduration / 1000))) - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] attempts to feed [M] [src].", 1) + user.visible_message("[user] attempts to feed [M] [src].") else - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] cannot force anymore of [src] down [M]'s throat.", 1) - return 0 + user.visible_message("[user] cannot force anymore of [src] down [M]'s throat.") + return 0 if(!do_mob(user, M)) return @@ -94,8 +92,7 @@ user.attack_log += text("\[[time_stamp()]\] Fed [src.name] by [M.name] ([M.ckey]) Reagents: [reagentlist(src)]") msg_admin_attack("[key_name(user)] fed [key_name(M)] with [src.name] Reagents: [reagentlist(src)] (INTENT: [uppertext(user.a_intent)])") - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] feeds [M] [src].", 1) + user.visible_message("[user] feeds [M] [src].") else user << "This creature does not seem to have a mouth!" diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index c5bb2a0795..d38c159868 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -24,7 +24,7 @@ if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - H << "\red You have a monitor for a head, where do you think you're going to put that?" + H << "You have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -32,7 +32,7 @@ user << "\The [blocked] is in the way!" return - M << "\blue You swallow [src]." + M << "You swallow [src]." M.drop_from_inventory(src) //icon update if(reagents.total_volume) reagents.trans_to_ingest(M, reagents.total_volume) @@ -45,7 +45,7 @@ var/mob/living/carbon/human/H = M if(H.species.flags & IS_SYNTHETIC) - user << "\red They have a monitor for a head, where do you think you're going to put that?" + user << "They have a monitor for a head, where do you think you're going to put that?" return var/obj/item/blocked = H.check_mouth_coverage() @@ -53,14 +53,12 @@ user << "\The [blocked] is in the way!" return - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] attempts to force [M] to swallow [src].", 1) + user.visible_message("[user] attempts to force [M] to swallow [src].") if(!do_mob(user, M)) return user.drop_from_inventory(src) //icon update - for(var/mob/O in viewers(world.view, user)) - O.show_message("\red [user] forces [M] to swallow [src].", 1) + user.visible_message("[user] forces [M] to swallow [src].") 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)]") diff --git a/html/changelogs/HarpyEagle-fooddrinkpill.yml b/html/changelogs/HarpyEagle-fooddrinkpill.yml new file mode 100644 index 0000000000..c9f64eb4d9 --- /dev/null +++ b/html/changelogs/HarpyEagle-fooddrinkpill.yml @@ -0,0 +1,7 @@ + +author: HarpyEagle + +delete-after: True + +changes: + - rscadd: "Masks and helmets that cover the face block feeding food, drinks, and pills."