Skip to content

Commit

Permalink
New Accents, Accent Weight Change + New Irish Accent Redux (From PR #…
Browse files Browse the repository at this point in the history
…1640 Thanks GitHub) (#1701)

* From the top! - Redid my branch...

* Cleanup with some comments and explanation

* Testing if Accentless is issue- failed build test

* Wasn't the bug-

* Changed accent weights based off int discussion

* uh, forgot comment change

* Changed comments a final time- reflect new weights

---------

Co-authored-by: Adeinitas <[email protected]>
  • Loading branch information
SsalamethVersaach and Adeinitas authored Aug 31, 2024
1 parent 1e2eb23 commit 303eae8
Show file tree
Hide file tree
Showing 7 changed files with 1,006 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Server.DeltaV.Speech.EntitySystems;

namespace Content.Server.DeltaV.Speech.Components;

// Takes the ES and assigns the system and component to each other
[RegisterComponent]
[Access(typeof(IrishAccentSystem))]
public sealed partial class IrishAccentComponent : Component
{ }
33 changes: 33 additions & 0 deletions Content.Server/DeltaV/Speech/EntitySystems/IrishAccentSystem.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 IrishAccentSystem : EntitySystem
{
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

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

SubscribeLocalEvent<IrishAccentComponent, AccentGetEvent>(OnAccentGet);
}

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

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

return msg;
}

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

0 comments on commit 303eae8

Please sign in to comment.