Skip to content

Commit

Permalink
Make the system
Browse files Browse the repository at this point in the history
  • Loading branch information
DangerRevolution committed Mar 8, 2024
1 parent b06e894 commit f9df90b
Show file tree
Hide file tree
Showing 6 changed files with 896 additions and 2 deletions.
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(GermanAccentSystem))]
public sealed partial class GermanAccentComponent : Component
{ }
33 changes: 33 additions & 0 deletions Content.Server/DeltaV/Speech/EntitySystems/GermanAccentSystem.cs
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 GermanAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

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

SubscribeLocalEvent<GermanAccentComponent, AccentGetEvent>(OnAccentGet);
}

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

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

return msg;
}

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

0 comments on commit f9df90b

Please sign in to comment.