2021-10-11 20:18:39 +02:00
|
|
|
|
using Content.Server.Speech.Components;
|
|
|
|
|
|
using Robust.Shared.Random;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Speech.EntitySystems
|
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class OwOAccentSystem : EntitySystem
|
2021-10-11 20:18:39 +02:00
|
|
|
|
{
|
|
|
|
|
|
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "you", "wu" },
|
2024-08-09 00:47:18 +03:00
|
|
|
|
{ "ты", "ти" } // WD
|
2021-10-11 20:18:39 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
SubscribeLocalEvent<OwOAccentComponent, AccentGetEvent>(OnAccent);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Accentuate(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var (word, repl) in SpecialWords)
|
|
|
|
|
|
{
|
|
|
|
|
|
message = message.Replace(word, repl);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-09 00:47:18 +03:00
|
|
|
|
return message.Replace("r", "w").Replace("R", "W")
|
2023-04-23 18:30:37 +06:00
|
|
|
|
.Replace("l", "w").Replace("L", "W")
|
|
|
|
|
|
|
|
|
|
|
|
//WD-EDIT
|
|
|
|
|
|
.Replace("р", "в").Replace("Р", "В")
|
|
|
|
|
|
.Replace("л", "в").Replace("Л", "В");
|
|
|
|
|
|
//WD-EDIT
|
2021-10-11 20:18:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnAccent(EntityUid uid, OwOAccentComponent component, AccentGetEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Message = Accentuate(args.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|