using System.Text.RegularExpressions; using Content.Server.Chat; using Content.Server.Chat.Systems; using Content.Server.Speech.Components; namespace Content.Server.Speech { public sealed class AccentSystem : EntitySystem { public static readonly Regex SentenceRegex = new(@"(?<=[\.!\?])", RegexOptions.Compiled); public override void Initialize() { SubscribeLocalEvent(AccentHandler); } private void AccentHandler(TransformSpeechEvent args) { var accentEvent = new AccentGetEvent(args.Sender, args.Message); if (!HasComp(args.Sender)) { RaiseLocalEvent(args.Sender, accentEvent, true); args.Message = accentEvent.Message; } } } public sealed class AccentGetEvent : EntityEventArgs { /// /// The entity to apply the accent to. /// public EntityUid Entity { get; } /// /// The message to apply the accent transformation to. /// Modify this to apply the accent. /// public string Message { get; set; } public AccentGetEvent(EntityUid entity, string message) { Entity = entity; Message = message; } } }