diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm index d6f861b987b..2888899b223 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -135,3 +135,7 @@ /// From /atom/movable/screen/zone_sel/proc/set_selected_zone. /// Fires when the user has changed their selected body target. #define COMSIG_MOB_SELECTED_ZONE_SET "mob_set_selected_zone" +/// from base of [/client/proc/handle_spam_prevention] (message, mute_type) +#define COMSIG_MOB_AUTOMUTE_CHECK "client_automute_check" // The check is performed by the client. + /// Prevents the automute system checking this client for repeated messages. + #define WAIVE_AUTOMUTE_CHECK (1<<0) diff --git a/code/datums/components/deadchat_control.dm b/code/datums/components/deadchat_control.dm index 16b37877f6a..1742a3859d6 100644 --- a/code/datums/components/deadchat_control.dm +++ b/code/datums/components/deadchat_control.dm @@ -130,15 +130,36 @@ SIGNAL_HANDLER RegisterSignal(orbiter, COMSIG_MOB_DEADSAY, .proc/deadchat_react) + RegisterSignal(orbiter, COMSIG_MOB_AUTOMUTE_CHECK, .proc/waive_automute) orbiters |= orbiter + /datum/component/deadchat_control/proc/orbit_stop(atom/source, atom/orbiter) SIGNAL_HANDLER if(orbiter in orbiters) - UnregisterSignal(orbiter, COMSIG_MOB_DEADSAY) + UnregisterSignal(orbiter, list( + COMSIG_MOB_DEADSAY, + COMSIG_MOB_AUTOMUTE_CHECK, + )) orbiters -= orbiter +/** + * Prevents messages used to control the parent from counting towards the automute threshold for repeated identical messages. + * + * Arguments: + * - [speaker][/client]: The mob that is trying to speak. + * - [client][/client]: The client that is trying to speak. + * - message: The message that the speaker is trying to say. + * - mute_type: Which type of mute the message counts towards. + */ +/datum/component/deadchat_control/proc/waive_automute(mob/speaker, client/client, message, mute_type) + SIGNAL_HANDLER + if(mute_type == MUTE_DEADCHAT && inputs[lowertext(message)]) + return WAIVE_AUTOMUTE_CHECK + return NONE + + /// Allows for this component to be removed via a dedicated VV dropdown entry. /datum/component/deadchat_control/proc/handle_vv_topic(datum/source, mob/user, list/href_list) SIGNAL_HANDLER diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index b56d8142675..11d669cef6b 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -166,6 +166,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(CONFIG_GET(flag/automute_on) && !holder && last_message == message) + if(SEND_SIGNAL(mob, COMSIG_MOB_AUTOMUTE_CHECK, src, last_message, mute_type) & WAIVE_AUTOMUTE_CHECK) + return FALSE + src.last_message_count++ if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE) to_chat(src, span_danger("You have exceeded the spam filter limit for identical messages. A mute was automatically applied for the current round. Contact admins to request its removal."))