mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
* Adds Anglish accent * I'm done * really?? * add traits and add/subtract * Update anglish.ftl lol * Did the stuff * changed eth to thorn and added species * forgot about a file & misc change * Apply suggestions from code review Co-authored-by: Tobias Berger <toby@tobot.dev> Signed-off-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> * rip Regex * misspelling * ILOVEWORDSILOVEWORDS * vitally important replacement * even more words * updated it * update --------- Signed-off-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> Co-authored-by: Tobias Berger <toby@tobot.dev>
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Text.RegularExpressions;
|
|
using Content.Server.Speech.Components;
|
|
using Content.Shared.Speech;
|
|
|
|
namespace Content.Server.Speech.EntitySystems;
|
|
|
|
/// <summary>
|
|
/// System that replaces certain vocabulary to be similar to Anglish.
|
|
/// </summary>
|
|
public sealed class AnglishAccentSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AnglishAccentComponent, AccentGetEvent>(OnAccentGet);
|
|
}
|
|
|
|
public string Accentuate(string message, AnglishAccentComponent component)
|
|
{
|
|
var msg = message;
|
|
|
|
msg = _replacement
|
|
.ApplyReplacements(msg, "anglish")
|
|
.Replace("th", "þ")
|
|
.Replace("Th", "Þ")
|
|
.Replace("TH", "Þ");
|
|
|
|
return msg;
|
|
}
|
|
|
|
private void OnAccentGet(EntityUid uid, AnglishAccentComponent component, AccentGetEvent args)
|
|
{
|
|
args.Message = Accentuate(args.Message, component);
|
|
}
|
|
}
|