Files
Delta-v/Content.Server/Speech/AccentSystem.cs
T
alexalexmax d8ce0d767b Voice mask effects are toggleable and hide your accent (#41965)
* apply negate accents system

* add toggle to voice mask ui

* roll negateaccents into voice mask system, delete negate accents comp&system, update yml entries

* convert button to ToggleButton and some cleanup

* retry for heisenfail

* accent toggle

* update names and add mask active check for accent hiding
2026-04-04 16:57:20 +02:00

27 lines
704 B
C#

using System.Text.RegularExpressions;
using Content.Shared.Chat;
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)
{
if (args.Cancelled)
return;
var accentEvent = new AccentGetEvent(args.Sender, args.Message);
RaiseLocalEvent(args.Sender, accentEvent, true);
args.Message = accentEvent.Message;
}
}