Make common netspeak get replaced in the chat (#20180)
* added more slang to the sanitization manager * idk why this file is here * Added new sanitization accent * No longer is an acccent, instead is a dictionary * Reverted back to a system similar to before, added the new netspeak from the dictionary * Added some new words to the chat san * Added (wdym --> what do you mean) to the chatsan * merge conflict * removed boolvalue * remove space * Upcoming * Added MF and ETC to chatsan :)) * upcoming * added FYI and WYD to speech-chatsan.ftl * Made the chatsan accent string a const string with [ValidatePrototypeId<AccentPrototype>] * forgot the ';' :((( * fixed error throw [AccentPrototype] --> [ReplacementAccentPrototype]
This commit is contained in:
@@ -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<ReplacementAccentPrototype>]
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns list of players and ranges for all players withing some range. Also returns observers with a range of -1.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user