Files
tbd-station-14/Content.Server/Speech/AccentSystem.cs
Princess Cheeseballs 367ff79006 Accents Event to Shared (#38948)
* 27 file diff

* 27 file diff 2

* Apply suggestions from code review

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-07-12 22:52:51 +02:00

24 lines
663 B
C#

using System.Text.RegularExpressions;
using Content.Server.Chat.Systems;
using Content.Shared.Speech;
namespace Content.Server.Speech;
public sealed class AccentSystem : EntitySystem
{
public static readonly Regex SentenceRegex = new(@"(?<=[\.!\?‽])(?![\.!\?‽])", RegexOptions.Compiled);
public override void Initialize()
{
SubscribeLocalEvent<TransformSpeechEvent>(AccentHandler);
}
private void AccentHandler(TransformSpeechEvent args)
{
var accentEvent = new AccentGetEvent(args.Sender, args.Message);
RaiseLocalEvent(args.Sender, accentEvent, true);
args.Message = accentEvent.Message;
}
}