From 1c4a5180edc33c2f52f3fc0fd82e95cf339f58d3 Mon Sep 17 00:00:00 2001
From: DGamerL <108773801+DGamerL@users.noreply.github.com>
Date: Wed, 5 Feb 2025 22:26:20 +0100
Subject: [PATCH] Fixes runtimes when you talk with a cig butt in your mouth
(#28250)
* Minor fixes
* Oops
* Funnyman review
---
code/__DEFINES/is_helpers.dm | 2 ++
code/__DEFINES/mob_defines.dm | 3 ---
code/datums/outfits/outfit_admin.dm | 3 ++-
code/game/dna/mutations/mutation_powers.dm | 24 ++++++++++++-------
code/game/objects/items.dm | 4 ++++
code/modules/clothing/clothing.dm | 4 ----
.../modules/mob/living/carbon/carbon_procs.dm | 5 ++--
.../mob/living/carbon/human/species/unathi.dm | 8 ++++---
code/modules/mob/mob_vars.dm | 5 ++--
9 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm
index d15b60f05cd..2e889278c1e 100644
--- a/code/__DEFINES/is_helpers.dm
+++ b/code/__DEFINES/is_helpers.dm
@@ -62,6 +62,8 @@
#define isclothing(A) (istype(A, /obj/item/clothing))
+#define ismask(A) (istype(A, /obj/item/clothing/mask))
+
#define isprojectile(A) (istype(A, /obj/item/projectile))
#define isgun(A) (istype(A, /obj/item/gun))
diff --git a/code/__DEFINES/mob_defines.dm b/code/__DEFINES/mob_defines.dm
index 92fa20a22f8..81d6c5d6122 100644
--- a/code/__DEFINES/mob_defines.dm
+++ b/code/__DEFINES/mob_defines.dm
@@ -276,9 +276,6 @@
#define is_ai_eye(A) (istype((A), /mob/camera/eye))
#define isovermind(A) (istype((A), /mob/camera/blob))
-#define isSpirit(A) (istype((A), /mob/spirit))
-#define ismask(A) (istype((A), /mob/spirit/mask))
-
#define isobserver(A) (istype((A), /mob/dead/observer))
#define isnewplayer(A) (istype((A), /mob/new_player))
diff --git a/code/datums/outfits/outfit_admin.dm b/code/datums/outfits/outfit_admin.dm
index bb24e3affe3..06163845e26 100644
--- a/code/datums/outfits/outfit_admin.dm
+++ b/code/datums/outfits/outfit_admin.dm
@@ -1607,7 +1607,8 @@
H.update_fhair()
H.update_dna()
- H.wear_mask.adjustmask(H) // push it back on the head
+ var/obj/item/clothing/mask/worn_mask = H.wear_mask
+ worn_mask.adjustmask(H) // push it back on the head
equip_item(H, /obj/item/clothing/mask/cigarette/cigar, ITEM_SLOT_MASK) // get them their cigar
if(istype(H.glasses, /obj/item/clothing/glasses)) // this is gonna be always true
var/obj/item/clothing/glasses/glassass = H.glasses
diff --git a/code/game/dna/mutations/mutation_powers.dm b/code/game/dna/mutations/mutation_powers.dm
index e13572621a0..9f9f4ad2252 100644
--- a/code/game/dna/mutations/mutation_powers.dm
+++ b/code/game/dna/mutations/mutation_powers.dm
@@ -384,14 +384,22 @@
. = ..()
if(!.)
return
- var/can_eat = TRUE
- if(iscarbon(user))
- var/mob/living/carbon/C = user
- if((C.head && (C.head.flags_cover & HEADCOVERSMOUTH)) || (C.wear_mask && (C.wear_mask.flags_cover & MASKCOVERSMOUTH) && !C.wear_mask.up))
- if(show_message)
- to_chat(C, "Your mouth is covered, preventing you from eating!")
- can_eat = FALSE
- return can_eat
+
+ if(!iscarbon(user))
+ return TRUE
+
+ var/mob/living/carbon/C = user
+ if(!(C.head?.flags_cover & HEADCOVERSMOUTH))
+ if(!ismask(C.wear_mask))
+ return TRUE
+
+ var/obj/item/clothing/mask/worn_mask = C.wear_mask
+ if(!(worn_mask.flags_cover & MASKCOVERSMOUTH) || worn_mask.up)
+ return TRUE
+
+ if(show_message)
+ to_chat(C, "Your mouth is covered, preventing you from eating!")
+ return FALSE
/datum/spell/eat/proc/doHeal(mob/user)
if(ishuman(user))
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index ab8b3bff533..1de8b63b6c0 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -1017,3 +1017,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
return FALSE
return cig
+
+/// Changes the speech verb when wearing this item if a value is returned
+/obj/item/proc/change_speech_verb()
+ return
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 188c54e8cb3..17937982df0 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -613,10 +613,6 @@
var/datum/action/A = X
A.UpdateButtons()
-// Changes the speech verb when wearing a mask if a value is returned
-/obj/item/clothing/mask/proc/change_speech_verb()
- return
-
//////////////////////////////
// MARK: SHOES
//////////////////////////////
diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm
index 4d15ad53a0a..0f429f764eb 100644
--- a/code/modules/mob/living/carbon/carbon_procs.dm
+++ b/code/modules/mob/living/carbon/carbon_procs.dm
@@ -1253,8 +1253,9 @@ so that different stomachs can handle things in different ways VB*/
if(istype(head, /obj/item/clothing/head))
var/obj/item/clothing/head/HT = head
. += HT.tint
- if(istype(wear_mask))
- . += wear_mask.tint
+ if(ismask(wear_mask))
+ var/obj/item/clothing/mask/worn_mask = wear_mask
+ . += worn_mask.tint
var/obj/item/organ/internal/eyes/E = get_organ_slot("eyes")
if(E)
diff --git a/code/modules/mob/living/carbon/human/species/unathi.dm b/code/modules/mob/living/carbon/human/species/unathi.dm
index 9d39401ccf2..064f551d6a9 100644
--- a/code/modules/mob/living/carbon/human/species/unathi.dm
+++ b/code/modules/mob/living/carbon/human/species/unathi.dm
@@ -90,9 +90,11 @@
to_chat(user, "Your throat hurts too much to do it right now. Wait [round((cooldown - world.time) / 10)] seconds and try again.")
return
if(!welding_fuel_used || user.reagents.has_reagent("fuel", welding_fuel_used))
- if((user.head?.flags_cover & HEADCOVERSMOUTH) || (user.wear_mask?.flags_cover & MASKCOVERSMOUTH) && !user.wear_mask?.up)
- to_chat(user, "Your mouth is covered.")
- return
+ if(ismask(user.wear_mask))
+ var/obj/item/clothing/mask/worn_mask = user.wear_mask
+ if((user.head?.flags_cover & HEADCOVERSMOUTH) || (worn_mask.flags_cover & MASKCOVERSMOUTH) && !worn_mask.up)
+ to_chat(user, "Your mouth is covered.")
+ return
var/obj/item/match/unathi/fire = new(user.loc, src)
if(user.put_in_hands(fire))
to_chat(user, "You ignite a small flame in your mouth.")
diff --git a/code/modules/mob/mob_vars.dm b/code/modules/mob/mob_vars.dm
index 605a1043d4f..03d9b375faa 100644
--- a/code/modules/mob/mob_vars.dm
+++ b/code/modules/mob/mob_vars.dm
@@ -80,8 +80,9 @@
var/obj/item/back = null //Human
var/obj/item/tank/internal = null //Human
/// Active storage container
- var/obj/item/storage/s_active = null //Carbon
- var/obj/item/clothing/mask/wear_mask = null //Carbon
+ var/obj/item/storage/s_active
+ /// The currently worn mask
+ var/obj/item/wear_mask
/// The instantiated version of the mob's hud.
var/datum/hud/hud_used = null