Files
tbd-station-14/Content.Server/Speech/EntitySystems/ArchaicAccentSystem.cs
Ubaser 993086df20 Archaic Accent fixes (#17897)
* added accent changes

* added changes for the words "ok, k, okay"

* fix prefixes and the 'd

* add more words

* fix some and add more words

* fix more and add more
2023-07-08 02:34:11 -06:00

33 lines
993 B
C#

using Content.Server.Speech.Components;
using Robust.Shared.Random;
using System.Text.RegularExpressions;
namespace Content.Server.Speech.EntitySystems;
public sealed class ArchaicAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ArchaicAccentComponent, AccentGetEvent>(OnAccentGet);
}
// converts left word when typed into the right word. For example typing you becomes ye.
public string Accentuate(string message, ArchaicAccentComponent component)
{
var msg = message;
msg = _replacement.ApplyReplacements(msg, "archaic");
return msg;
}
private void OnAccentGet(EntityUid uid, ArchaicAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message, component);
}
}