mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00:00
* 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
27 lines
704 B
C#
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;
|
|
}
|
|
}
|