Files
tbd-station-14/Content.Server/Speech/EntitySystems/OwOAccentSystem.cs
Moony 469d57f34e owo (#5510)
* owo

* URGENT FIXES

* typo moment
2021-11-26 23:43:33 -07:00

45 lines
1.3 KiB
C#

using System.Collections.Generic;
using Content.Server.Speech.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Random;
namespace Content.Server.Speech.EntitySystems
{
public class OwOAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
private static readonly IReadOnlyList<string> Faces = new List<string>{
" (・`ω´・)", " ;;w;;", " owo", " UwU", " >w<", " ^w^"
}.AsReadOnly();
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
{
{ "you", "wu" },
};
public override void Initialize()
{
SubscribeLocalEvent<OwOAccentComponent, AccentGetEvent>(OnAccent);
}
public string Accentuate(string message)
{
foreach (var (word, repl) in SpecialWords)
{
message = message.Replace(word, repl);
}
return message.Replace("!", _random.Pick(Faces))
.Replace("r", "w").Replace("R", "W")
.Replace("l", "w").Replace("L", "W");
}
private void OnAccent(EntityUid uid, OwOAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message);
}
}
}