From a4f053f0d9aaf7979d5caebc32bfd74d7a218bf4 Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Sun, 30 Nov 2025 14:38:51 -0500 Subject: [PATCH] Fixes emote singletons being mutated, and actually makes use of the type_override arg (#94178) ## About The Pull Request So this nice way of explicitly override an emote type exists, but for some reason it is not properly used and mostly nonfunctional. Custom emotes, a perfect use case for these, was just... mutating the singleton and then resetting it back, instead of actually making use of args. Sinful. Just sinful.
It does work, note the type override from the prompt making its way where needed. dreamseeker_DRS9nFqoQP Code_ZQfaj3GGSu
## Why It's Good For The Game Fixes a likely oversight/coding skill issue. Improves code modularity. ## Changelog Nothing anyone would notice, if this is working correctly. --- code/datums/brain_damage/split_personality.dm | 2 +- code/datums/emotes.dm | 18 ++++++++++++------ code/modules/clothing/head/jobs.dm | 2 +- code/modules/mob/emote.dm | 8 ++++---- code/modules/mob/eye/eye.dm | 2 +- code/modules/mob/living/emote.dm | 13 +++---------- code/modules/mob/mob_say.dm | 2 +- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/code/datums/brain_damage/split_personality.dm b/code/datums/brain_damage/split_personality.dm index 04285e07c2b..0fb56079a96 100644 --- a/code/datums/brain_damage/split_personality.dm +++ b/code/datums/brain_damage/split_personality.dm @@ -182,7 +182,7 @@ to_chat(src, span_warning("You cannot speak, your other self is controlling your body!")) return FALSE -/mob/living/split_personality/emote(act, m_type = null, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) +/mob/living/split_personality/emote(act, type_override = NONE, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) return FALSE ///////////////BRAINWASHING//////////////////// diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 65b74962fd9..396a15b64c6 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -94,13 +94,19 @@ */ /datum/emote/proc/run_emote(mob/user, params, type_override, intentional = FALSE) var/msg = select_message_type(user, message, intentional) - if(params && message_param) - msg = select_param(user, params) + if(params) + if(message_param) + msg = select_param(user, params) + else + msg = params msg = replace_pronoun(user, msg) if(!msg) return + /// Use the type override if it exists + var/running_emote_type = type_override || emote_type + if(user.client) user.log_message(msg, LOG_EMOTE) @@ -116,13 +122,13 @@ playsound(source = user,soundin = tmp_sound,vol = 50, vary = FALSE, ignore_walls = sound_wall_ignore, frequency = frequency) - var/is_important = emote_type & EMOTE_IMPORTANT - var/is_visual = emote_type & EMOTE_VISIBLE - var/is_audible = emote_type & EMOTE_AUDIBLE + var/is_important = running_emote_type & EMOTE_IMPORTANT + var/is_visual = running_emote_type & EMOTE_VISIBLE + var/is_audible = running_emote_type & EMOTE_AUDIBLE var/additional_message_flags = get_message_flags(intentional) // Emote doesn't get printed to chat, runechat only - if(emote_type & EMOTE_RUNECHAT) + if(running_emote_type & EMOTE_RUNECHAT) for(var/mob/viewer as anything in viewers(user)) if(isnull(viewer.client)) continue diff --git a/code/modules/clothing/head/jobs.dm b/code/modules/clothing/head/jobs.dm index 1a313c5c6c0..c92c7a02360 100644 --- a/code/modules/clothing/head/jobs.dm +++ b/code/modules/clothing/head/jobs.dm @@ -54,7 +54,7 @@ return locate(/mob/living/basic) in mousey_holder.contents /// Relays emotes emoted by your boss to the hat wearer for full immersion -/obj/item/clothing/head/utility/chefhat/proc/on_mouse_emote(mob/living/source, key, emote_message, type_override) +/obj/item/clothing/head/utility/chefhat/proc/on_mouse_emote(mob/living/source, key, emote_message, type_override, intentional, datum/emote/emote) SIGNAL_HANDLER var/mob/living/carbon/wearer = loc if(!wearer || INCAPACITATED_IGNORING(wearer, INCAPABLE_RESTRAINTS)) diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 5030ec91bb9..28c2f2e7282 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -12,7 +12,7 @@ #define BEYBLADE_CONFUSION_LIMIT (40 SECONDS) //The code execution of the emote datum is located at code/datums/emotes.dm -/mob/proc/emote(act, m_type = null, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) +/mob/proc/emote(act, type_override = NONE, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) var/param = message var/custom_param = findchar(act, " ") if(custom_param) @@ -33,11 +33,11 @@ continue if(!forced && !emote.can_run_emote(src, TRUE, intentional, param)) continue - if(SEND_SIGNAL(src, COMSIG_MOB_PRE_EMOTED, emote.key, param, m_type, intentional, emote) & COMPONENT_CANT_EMOTE) + if(SEND_SIGNAL(src, COMSIG_MOB_PRE_EMOTED, emote.key, param, type_override, intentional, emote) & COMPONENT_CANT_EMOTE) silenced = TRUE continue - emote.run_emote(src, param, m_type, intentional) - SEND_SIGNAL(src, COMSIG_MOB_EMOTE, emote, act, m_type, message, intentional) + emote.run_emote(src, param, type_override, intentional) + SEND_SIGNAL(src, COMSIG_MOB_EMOTE, emote, act, type_override, message, intentional) SEND_SIGNAL(src, COMSIG_MOB_EMOTED(emote.key)) return TRUE if(intentional && !silenced && !force_silence) diff --git a/code/modules/mob/eye/eye.dm b/code/modules/mob/eye/eye.dm index 74efd39f610..fb3c2a4fab7 100644 --- a/code/modules/mob/eye/eye.dm +++ b/code/modules/mob/eye/eye.dm @@ -44,7 +44,7 @@ z_move_flags |= ZMOVE_IGNORE_OBSTACLES //cameras do not respect these FLOORS you speak so much of return ..() -/mob/eye/emote(act, m_type=1, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) +/mob/eye/emote(act, type_override = EMOTE_VISIBLE, message = null, intentional = FALSE, force_silence = FALSE, forced = FALSE) if(has_emotes) return ..() return FALSE diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index 21ad53291c9..4f590bf0012 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -698,6 +698,7 @@ /datum/emote/living/custom key = "me" key_third_person = "custom" + emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE message = null /datum/emote/living/custom/can_run_emote(mob/user, status_check, intentional, params) @@ -782,23 +783,15 @@ if(!emote_is_valid(user, our_message)) return FALSE - if(type_override) - emote_type = type_override - if(!params) var/user_emote_type = get_custom_emote_type_from_user() if(!user_emote_type) return FALSE - emote_type = user_emote_type + type_override = user_emote_type - message = our_message - . = ..() - - ///Reset the message and emote type after it's run. - message = null - emote_type = EMOTE_VISIBLE + . = ..(user = user, params = our_message, type_override = type_override, intentional = intentional) /datum/emote/living/custom/replace_pronoun(mob/user, message) return message diff --git a/code/modules/mob/mob_say.dm b/code/modules/mob/mob_say.dm index 5442dddc72b..a33fff987b7 100644 --- a/code/modules/mob/mob_say.dm +++ b/code/modules/mob/mob_say.dm @@ -50,7 +50,7 @@ message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN)) - QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_PROC_REF(/mob, emote), "me", EMOTE_VISIBLE|EMOTE_AUDIBLE, message, TRUE), SSspeech_controller) + QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_PROC_REF(/mob, emote), "me", NONE, message, TRUE), SSspeech_controller) /mob/try_speak(message, ignore_spam = FALSE, forced = null, filterproof = FALSE) var/list/filter_result