Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scottish Trait #608

Merged
merged 12 commits into from
Dec 29, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Server.DeltaV.Speech.EntitySystems;

namespace Content.Server.DeltaV.Speech.Components;

[RegisterComponent]
[Access(typeof(ScottishAccentSystem))]
public sealed partial class ScottishAccentComponent : Component
{ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Content.Server.DeltaV.Speech.Components;
using Content.Server.Speech;
using Content.Server.Speech.EntitySystems;
using System.Text.RegularExpressions;

namespace Content.Server.DeltaV.Speech.EntitySystems;

public sealed class ScottishAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ScottishAccentComponent, AccentGetEvent>(OnAccentGet);
}

// converts left word when typed into the right word. For example typing you becomes ye.
public string Accentuate(string message, ScottishAccentComponent component)
{
var msg = message;

msg = _replacement.ApplyReplacements(msg, "scottish");

return msg;
}

private void OnAccentGet(EntityUid uid, ScottishAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message, component);
}
}
Loading
Loading