diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 4ed1101fbee..285a55da249 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -320,6 +320,8 @@ var/modify_pull_push_speed = FALSE var/pixel_shift = FALSE + + var/ignore_obscured_mouth = FALSE var/ai_heat = FALSE @@ -912,11 +914,15 @@ if("override_map") config.override_map = value + if("modify_pull_push_speed") config.modify_pull_push_speed = TRUE if("pixel_shift") config.pixel_shift = TRUE + + if("ignore_obscured_mouth") + config.ignore_obscured_mouth = TRUE if("ai_heat") config.ai_heat = TRUE diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 0cf882f375c..f14945fac3a 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -57,11 +57,7 @@ if(length(contents)) var/obj/item/reagent_containers/food/snacks/toEat = contents[1] if(istype(toEat)) - if(!get_location_accessible(C, "mouth")) - if(C == user) - to_chat(user, "Your face is obscured, so you cant eat.") - else - to_chat(user, "[C]'s face is obscured, so[C.p_they()] cant eat.") + if(C.is_mouth_obscured(user)) return if(C.eat(toEat, user)) toEat.On_Consume(C, user) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index ed50c122233..e57d92690de 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -36,14 +36,12 @@ to_chat(user, " You need to open [src] first!") return FALSE + if(M.is_mouth_obscured(user)) + return FALSE + if(istype(M, /mob/living/carbon)) var/mob/living/carbon/C = M - if(!get_location_accessible(C, "mouth")) - if(C == user) - to_chat(user, "Your face is obscured, so you cant eat.") - else - to_chat(user, "[C]'s face is obscured, so[C.p_they()] cant eat.") - return FALSE + var/list/transfer_data = reagents.get_transferred_reagents(C, amount_per_transfer_from_this) if(C.eat(src, user)) diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index fad914a4f74..9e85ac4b9c2 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -45,11 +45,7 @@ to_chat(user, "None of [src] left, oh no!") return 0 - if(!get_location_accessible(M, "mouth")) - if(M == user) - to_chat(user, "Your face is obscured, so you cant eat.") - else - to_chat(user, "[M]'s face is obscured, so[M.p_they()] cant eat.") + if(M.is_mouth_obscured(user)) return FALSE if(M == user) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 0500d1d5289..9044f77d01d 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -74,11 +74,7 @@ qdel(src) return FALSE - if(!get_location_accessible(M, "mouth")) - if(M == user) - to_chat(user, "Your face is obscured, so you cant eat.") - else - to_chat(user, "[M]'s face is obscured, so[M.p_they()] cant eat.") + if(M.is_mouth_obscured(user)) return FALSE if(iscarbon(M)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d0d32a49407..5e87968de8b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1190,3 +1190,15 @@ else . = invoked_callback.Invoke() usr = temp + +/// Check if +/mob/proc/is_mouth_obscured(mob/attacker) + . = FALSE + if(config.ignore_obscured_mouth) + return + if(!get_location_accessible(src, "mouth")) + if(src == attacker) + to_chat(attacker, span_warning("Your face is obscured, so you can't eat")) + else + to_chat(attacker, span_warning("[src]'s face is obscured, so [src.p_they()] can't eat.")) + return TRUE diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index ffe49a08edb..2b1ed32a003 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -24,11 +24,7 @@ /obj/item/reagent_containers/food/pill/attack(mob/living/carbon/M, mob/user, def_zone) if(!istype(M)) return FALSE - if(!get_location_accessible(M, "mouth")) - if(M == user) - to_chat(user, "Your face is obscured, so you cant eat.") - else - to_chat(user, "[M]'s face is obscured, so[M.p_they()] cant eat.") + if(M.is_mouth_obscured(user)) return FALSE bitesize = reagents.total_volume if(M.eat(src, user)) diff --git a/config/example/config.txt b/config/example/config.txt index 2eea8593897..fd9dfff89c7 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -602,3 +602,5 @@ MODIFY_PULL_PUSH_SPEED ## Enable animations on item pickup and drop down # ITEM_ANIMATIONS_ENABLED +## Can eat through blocked mouth? +#IGNORE_OBSCURED_MOUTH