Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.

feat: Mouth obscuration is now config dependant #25

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@
var/modify_pull_push_speed = FALSE

var/pixel_shift = FALSE

var/ignore_obscured_mouth = FALSE

var/ai_heat = FALSE

Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions code/game/objects/items/weapons/kitchen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<span class='warning'>Your face is obscured, so you cant eat.</span>")
else
to_chat(user, "<span class='warning'>[C]'s face is obscured, so[C.p_they()] cant eat.</span>")
if(C.is_mouth_obscured(user))
return
if(C.eat(toEat, user))
toEat.On_Consume(C, user)
Expand Down
10 changes: 4 additions & 6 deletions code/modules/food_and_drinks/drinks/drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@
to_chat(user, "<span class='warning'> You need to open [src] first!</span>")
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, "<span class='warning'>Your face is obscured, so you cant eat.</span>")
else
to_chat(user, "<span class='warning'>[C]'s face is obscured, so[C.p_they()] cant eat.</span>")
return FALSE


var/list/transfer_data = reagents.get_transferred_reagents(C, amount_per_transfer_from_this)
if(C.eat(src, user))
Expand Down
6 changes: 1 addition & 5 deletions code/modules/food_and_drinks/food/condiment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
to_chat(user, "<span class='warning'>None of [src] left, oh no!</span>")
return 0

if(!get_location_accessible(M, "mouth"))
if(M == user)
to_chat(user, "<span class='warning'>Your face is obscured, so you cant eat.</span>")
else
to_chat(user, "<span class='warning'>[M]'s face is obscured, so[M.p_they()] cant eat.</span>")
if(M.is_mouth_obscured(user))
return FALSE

if(M == user)
Expand Down
6 changes: 1 addition & 5 deletions code/modules/food_and_drinks/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@
qdel(src)
return FALSE

if(!get_location_accessible(M, "mouth"))
if(M == user)
to_chat(user, "<span class='warning'>Your face is obscured, so you cant eat.</span>")
else
to_chat(user, "<span class='warning'>[M]'s face is obscured, so[M.p_they()] cant eat.</span>")
if(M.is_mouth_obscured(user))
return FALSE

if(iscarbon(M))
Expand Down
12 changes: 12 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 1 addition & 5 deletions code/modules/reagents/reagent_containers/pill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<span class='warning'>Your face is obscured, so you cant eat.</span>")
else
to_chat(user, "<span class='warning'>[M]'s face is obscured, so[M.p_they()] cant eat.</span>")
if(M.is_mouth_obscured(user))
return FALSE
bitesize = reagents.total_volume
if(M.eat(src, user))
Expand Down
2 changes: 2 additions & 0 deletions config/example/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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