diff --git a/Content.Server/Chat/Managers/ChatSanitizationManager.cs b/Content.Server/Chat/Managers/ChatSanitizationManager.cs index d4a284b6cd..77119eefc0 100644 --- a/Content.Server/Chat/Managers/ChatSanitizationManager.cs +++ b/Content.Server/Chat/Managers/ChatSanitizationManager.cs @@ -54,6 +54,7 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager { "._.", "chatsan-surprised" }, { ".-.", "chatsan-confused" }, { "-_-", "chatsan-unimpressed" }, + { "smh", "chatsan-unimpressed" }, { "o/", "chatsan-waves" }, { "^^/", "chatsan-waves" }, { ":/", "chatsan-uncertain" }, @@ -66,10 +67,11 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager { "lel.", "chatsan-laughs" }, { "kek", "chatsan-laughs" }, { "kek.", "chatsan-laughs" }, + { "rofl", "chatsan-laughs" }, { "o7", "chatsan-salutes" }, { ";_;7", "chatsan-tearfully-salutes"}, { "idk", "chatsan-shrugs" }, - { "idk.", "chatsan-shrugs" } + { "idk.", "chatsan-shrugs" }, }; private bool _doSanitize; diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 24e13bcde2..455d34c907 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -1,6 +1,8 @@ using System.Globalization; using System.Linq; using System.Text; +using Content.Server.Speech.EntitySystems; +using Content.Server.Speech.Components; using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; using Content.Server.Chat.Managers; @@ -53,6 +55,7 @@ public sealed partial class ChatSystem : SharedChatSystem [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; + [Dependency] private readonly ReplacementAccentSystem _wordreplacement = default!; public const int VoiceRange = 10; // how far voice goes in world units public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units @@ -690,6 +693,8 @@ public sealed partial class ChatSystem : SharedChatSystem private string SanitizeInGameICMessage(EntityUid source, string message, out string? emoteStr, bool capitalize = true, bool punctuate = false, bool capitalizeTheWordI = true) { var newMessage = message.Trim(); + newMessage = SanitizeMessageReplaceWords(newMessage); + if (capitalize) newMessage = SanitizeMessageCapital(newMessage); if (capitalizeTheWordI) @@ -737,6 +742,20 @@ public sealed partial class ChatSystem : SharedChatSystem return message; } + [ValidatePrototypeId] + public const string ChatSanitize_Accent = "chatsanitize"; + + public string SanitizeMessageReplaceWords(string message) + { + if (string.IsNullOrEmpty(message)) return message; + + var msg = message; + + msg = _wordreplacement.ApplyReplacements(msg, ChatSanitize_Accent); + + return msg; + } + /// /// Returns list of players and ranges for all players withing some range. Also returns observers with a range of -1. /// diff --git a/Resources/Locale/en-US/speech/speech-chatsan.ftl b/Resources/Locale/en-US/speech/speech-chatsan.ftl new file mode 100644 index 0000000000..756dfc3f99 --- /dev/null +++ b/Resources/Locale/en-US/speech/speech-chatsan.ftl @@ -0,0 +1,116 @@ +chatsan-word-1 = omg +chatsan-replacement-1 = oh my god + +chatsan-word-2 = omfg +chatsan-replacement-2 = oh my fucking god + +chatsan-word-3 = ong +chatsan-replacement-3 = on god + +chatsan-word-4 = wtf +chatsan-replacement-4 = what the fuck + +chatsan-word-5 = ffs +chatsan-replacement-5 = for fuck's sake + +chatsan-word-6 = tf +chatsan-replacement-6 = the fuck + +chatsan-word-7 = afaik +chatsan-replacement-7 = as far as i know + +chatsan-word-8 = ik +chatsan-replacement-8 = i know + +chatsan-word-9 = ikr +chatsan-replacement-9 = i know, right + +chatsan-word-10 = idc +chatsan-replacement-10 = i don't care + +chatsan-word-12 = tbh +chatsan-replacement-12 = to be honest + +chatsan-word-13 = u +chatsan-replacement-13 = you + +chatsan-word-14 = ur +chatsan-replacement-14 = your + +chatsan-word-15 = mk +chatsan-replacement-15 = mmm, okay + +chatsan-word-16 = iirc +chatsan-replacement-16 = if i remember correctly + +chatsan-word-17 = np +chatsan-replacement-17 = no problem + +chatsan-word-18 = omw +chatsan-replacement-18 = on my way + +chatsan-word-19 = nvm +chatsan-replacement-19 = nevermind + +chatsan-word-20 = imo +chatsan-replacement-20 = in my opinion + +chatsan-word-21 = pls +chatsan-word-22 = plz +chatsan-word-23 = plox +chatsan-replacement-please = please + +chatsan-word-24 = fr +chatsan-replacement-24 = for real + +chatsan-word-25 = brb +chatsan-replacement-25 = be right back + +chatsan-word-26 = btw +chatsan-replacement-26 = by the way + +chatsan-word-27 = jk +chatsan-replacement-27 = just kidding + +chatsan-word-28 = thx +chatsan-replacement-28 = thanks + +chatsan-word-29 = ty +chatsan-replacement-29 = thank you + +chatsan-word-30 = afk +chatsan-replacement-30 = ssd + +chatsan-word-31 = stfu +chatsan-replacement-31 = shut the fuck up + +chatsan-word-32 = gtg +chatsan-replacement-32 = got to go + +chatsan-word-33 = gl +chatsan-replacement-33 = good luck + +chatsan-word-34 = hbu +chatsan-replacement-34 = how about you + +chatsan-word-35 = hmu +chatsan-replacement-35 = hit me up + +chatsan-word-36 = gtfo +chatsan-replacement-36 = get the fuck out + +chatsan-word-37 = wdym +chatsan-replacement-37 = what do you mean + +chatsan-word-38 = mf +chatsan-replacement-38 = motherfucker + +chatsan-word-39 = etc +chatsan-word-40 = etc. +chatsan-replacement-etcetera = etcetera + +chatsan-word-41 = fyi +chatsan-replacement-41 = for your information + +chatsan-word-42 = wyd +chatsan-replacement-42 = what you doing diff --git a/Resources/Prototypes/Accents/word_replacements.yml b/Resources/Prototypes/Accents/word_replacements.yml index befcfa6e6c..716196cbf4 100644 --- a/Resources/Prototypes/Accents/word_replacements.yml +++ b/Resources/Prototypes/Accents/word_replacements.yml @@ -490,4 +490,49 @@ accent-archaic-replaced-231: accent-archaic-replacement-231 accent-archaic-replaced-232: accent-archaic-replacement-232 - +# For the chat sanitization system +- type: accent + id: chatsanitize + wordReplacements: + chatsan-word-1: chatsan-replacement-1 + chatsan-word-2: chatsan-replacement-2 + chatsan-word-3: chatsan-replacement-3 + chatsan-word-4: chatsan-replacement-4 + chatsan-word-5: chatsan-replacement-5 + chatsan-word-6: chatsan-replacement-6 + chatsan-word-7: chatsan-replacement-7 + chatsan-word-8: chatsan-replacement-8 + chatsan-word-9: chatsan-replacement-9 + chatsan-word-10: chatsan-replacement-10 + chatsan-word-11: chatsan-replacement-11 + chatsan-word-12: chatsan-replacement-12 + chatsan-word-13: chatsan-replacement-13 + chatsan-word-14: chatsan-replacement-14 + chatsan-word-15: chatsan-replacement-15 + chatsan-word-16: chatsan-replacement-16 + chatsan-word-17: chatsan-replacement-17 + chatsan-word-18: chatsan-replacement-18 + chatsan-word-19: chatsan-replacement-19 + chatsan-word-20: chatsan-replacement-20 + chatsan-word-21: chatsan-replacement-please + chatsan-word-22: chatsan-replacement-please + chatsan-word-23: chatsan-replacement-please + chatsan-word-24: chatsan-replacement-24 + chatsan-word-25: chatsan-replacement-25 + chatsan-word-26: chatsan-replacement-26 + chatsan-word-27: chatsan-replacement-27 + chatsan-word-28: chatsan-replacement-28 + chatsan-word-29: chatsan-replacement-29 + chatsan-word-30: chatsan-replacement-30 + chatsan-word-31: chatsan-replacement-31 + chatsan-word-32: chatsan-replacement-32 + chatsan-word-33: chatsan-replacement-33 + chatsan-word-34: chatsan-replacement-34 + chatsan-word-35: chatsan-replacement-35 + chatsan-word-36: chatsan-replacement-36 + chatsan-word-37: chatsan-replacement-37 + chatsan-word-38: chatsan-replacement-38 + chatsan-word-39: chatsan-replacement-etcetera + chatsan-word-40: chatsan-replacement-etcetera + chatsan-word-41: chatsan-replacement-41 + chatsan-word-42: chatsan-replacement-42