From b1bfbf346d8a0abd3d151f69eb6590104407c902 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 11 May 2015 22:17:24 -0400 Subject: [PATCH] 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))