Refactor AccentManager to be an entity system, makes accents ECS. (#4825)
This commit is contained in:
committed by
GitHub
parent
55b4edb895
commit
4c80fb9586
26
Content.Server/Speech/EntitySystems/BackwardsAccentSystem.cs
Normal file
26
Content.Server/Speech/EntitySystems/BackwardsAccentSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Content.Server.Speech.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Speech.EntitySystems
|
||||
{
|
||||
public class BackwardsAccentSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<BackwardsAccentComponent, AccentGetEvent>(OnAccent);
|
||||
}
|
||||
|
||||
public string Accentuate(string message)
|
||||
{
|
||||
var arr = message.ToCharArray();
|
||||
Array.Reverse(arr);
|
||||
return new string(arr);
|
||||
}
|
||||
|
||||
private void OnAccent(EntityUid uid, BackwardsAccentComponent component, AccentGetEvent args)
|
||||
{
|
||||
args.Message = Accentuate(args.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user