CatStation/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs
2026-07-19 16:10:56 +07:00

40 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Content.Server.Speech.Components;
using Content.Shared.Speech.EntitySystems;
using Robust.Shared.Random;
namespace Content.Server.Speech.EntitySystems;
public sealed partial class BarkAccentSystem : RelayAccentSystem<BarkAccentComponent>
{
[Dependency] private IRobustRandom _random = default!;
private static readonly IReadOnlyList<string> Barks = new List<string>{
" Гав!", " ГАВ", " вуф-вуф" // Corvax-Localization
}.AsReadOnly();
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
{
{ "ah", "arf" },
{ "Ah", "Arf" },
{ "oh", "oof" },
{ "Oh", "Oof" },
//Corvax-Localization-Start
{ "га", "гаф" },
{ "Га", "Гаф" },
{ "угу", "вуф" },
{ "Угу", "Вуф" },
//Corvax-Localization-End
};
public override string Accentuate(string message, Entity<BarkAccentComponent>? ent = null)
{
foreach (var (word, repl) in SpecialWords)
{
message = message.Replace(word, repl);
}
return message.Replace("!", _random.Pick(Barks))
.Replace("l", "r").Replace("L", "R")
.Replace("л", "р").Replace("Л", "Р");//Corvax-Localization
}
}