* 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>
24 lines
663 B
C#
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;
|
|
}
|
|
}
|