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.

<details><summary> It does work, note the type override from the prompt
making its way where needed. </summary>

<img width="209" height="206" alt="dreamseeker_DRS9nFqoQP"
src="https://github.com/user-attachments/assets/35cbac9b-600f-4060-938e-519e110f330d"
/>

<img width="308" height="493" alt="Code_ZQfaj3GGSu"
src="https://github.com/user-attachments/assets/6847e070-d11f-4a32-90fa-edbb5e869e13"
/>

</details>

## 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.
This commit is contained in:
Bloop
2025-11-30 13:38:51 -06:00
committed by GitHub
parent 2ec99420a3
commit a4f053f0d9
7 changed files with 23 additions and 24 deletions
@@ -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////////////////////
+12 -6
View File
@@ -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
+1 -1
View File
@@ -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))
+4 -4
View File
@@ -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)
+1 -1
View File
@@ -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
+3 -10
View File
@@ -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
+1 -1
View File
@@ -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