From 33dbe6845239f908b9d5de5b858bbbf71e5ade99 Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 10 Jun 2019 00:15:39 +0200 Subject: [PATCH] Fixes forced say custom emotes properly. (#44328) --- code/modules/clothing/gloves/miscellaneous.dm | 4 +--- code/modules/mob/dead/observer/say.dm | 2 +- code/modules/mob/living/emote.dm | 7 ++++++- code/modules/mob/living/say.dm | 2 +- code/modules/mob/say.dm | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/code/modules/clothing/gloves/miscellaneous.dm b/code/modules/clothing/gloves/miscellaneous.dm index 48066ebc052..d402fa65228 100644 --- a/code/modules/clothing/gloves/miscellaneous.dm +++ b/code/modules/clothing/gloves/miscellaneous.dm @@ -75,7 +75,5 @@ /obj/item/clothing/gloves/rapid/attack_self(mob/user) var/input = stripped_input(user,"What do you want your battlecry to be? Max length of 6 characters.", ,"", 7) - if(input == "*me") //If they try to do a *me emote it will stop the attack to prompt them for an emote then they can walk away and enter the emote for a punch from far away - to_chat(user, "Invalid battlecry, please use another.") - else if(input) + if(input) warcry = input diff --git a/code/modules/mob/dead/observer/say.dm b/code/modules/mob/dead/observer/say.dm index 75f56024e7d..8364d42796b 100644 --- a/code/modules/mob/dead/observer/say.dm +++ b/code/modules/mob/dead/observer/say.dm @@ -15,7 +15,7 @@ client.dsay(message) return - if(check_emote(message)) + if(check_emote(message, forced)) return . = say_dead(message) diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index 0039c9f738b..0ba1b523827 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -399,6 +399,9 @@ key_third_person = "custom" message = null +/datum/emote/living/custom/can_run_emote(mob/user, status_check, intentional) + . = ..() && intentional + /datum/emote/living/custom/proc/check_invalid(mob/user, input) . = TRUE if(copytext(input,1,5) == "says") @@ -412,7 +415,9 @@ else . = FALSE -/datum/emote/living/custom/run_emote(mob/user, params, type_override = null) +/datum/emote/living/custom/run_emote(mob/user, params, type_override = null, intentional = FALSE) + if(!can_run_emote(user, TRUE, intentional)) + return FALSE if(is_banned_from(user.ckey, "Emote")) to_chat(user, "You cannot send custom emotes (banned).") return FALSE diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 8b209e7a496..75f7d7e7358 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -119,7 +119,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list( say_dead(original_message) return - if(check_emote(original_message) || !can_speak_basic(original_message, ignore_spam)) + if(check_emote(original_message, forced) || !can_speak_basic(original_message, ignore_spam)) return if(in_critical) diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 279bf5e7ca5..3e0d5238d6b 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -74,9 +74,9 @@ log_talk(message, LOG_SAY, tag="DEAD") deadchat_broadcast(rendered, follow_target = src, speaker_key = key) -/mob/proc/check_emote(message) +/mob/proc/check_emote(message, forced) if(copytext(message, 1, 2) == "*") - emote(copytext(message, 2), intentional = TRUE) + emote(copytext(message, 2), intentional = !forced) return 1 /mob/proc/hivecheck()