-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b06e894
commit f9df90b
Showing
6 changed files
with
896 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
Content.Server/DeltaV/Speech/Components/GermanAccentComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
33
Content.Server/DeltaV/Speech/EntitySystems/GermanAccentSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.