Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
AccentSystem Localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Tainakov committed Apr 16, 2024
1 parent 89d0718 commit 34e81ff
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Content.Server/Speech/EntitySystems/BarkAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public sealed class BarkAccentSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;

private static readonly IReadOnlyList<string> Barks = new List<string>{
" Woof!", " WOOF", " wof-wof"
" Гав!", " ГАВ", " вуф-вуф" // Corvax-Localization
}.AsReadOnly();

private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
Expand All @@ -17,6 +17,12 @@ public sealed class BarkAccentSystem : EntitySystem
{ "Ah", "Arf" },
{ "oh", "oof" },
{ "Oh", "Oof" },
//Corvax-Localization-Start
{ "га", "гаф" },
{ "Га", "Гаф" },
{ "угу", "вуф" },
{ "Угу", "Вуф" },
//Corvax-Localization-End
};

public override void Initialize()
Expand All @@ -33,6 +39,9 @@ public string Accentuate(string message)

return message.Replace("!", _random.Pick(Barks))
.Replace("l", "r").Replace("L", "R");
//Corvax-Localization-Start
.Replace("л", "р").Replace("Л", "Р");
//Corvax-Localization-End
}

private void OnAccent(EntityUid uid, BarkAccentComponent component, AccentGetEvent args)
Expand Down
53 changes: 53 additions & 0 deletions Content.Server/Speech/EntitySystems/LizardAccentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random;

namespace Content.Server.Speech.EntitySystems;

public sealed class LizardAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!; // Corvax-Localization
public override void Initialize()
{
base.Initialize();
Expand All @@ -26,6 +28,57 @@ private void OnAccent(EntityUid uid, LizardAccentComponent component, AccentGetE
// eckS
message = Regex.Replace(message, @"\bX([\-|r|R]|\b)", "ECKS$1");

// Corvax-Localization-Start
// c => ссс
message = Regex.Replace(
message,
"с+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// С => CCC
message = Regex.Replace(
message,
"С+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// з => ссс
message = Regex.Replace(
message,
"з+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// З => CCC
message = Regex.Replace(
message,
"З+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// ш => шшш
message = Regex.Replace(
message,
"ш+",
_random.Pick(new List<string>() { "шш", "шшш" })
);
// Ш => ШШШ
message = Regex.Replace(
message,
"Ш+",
_random.Pick(new List<string>() { "ШШ", "ШШШ" })
);
// ч => щщщ
message = Regex.Replace(
message,
"ч+",
_random.Pick(new List<string>() { "щщ", "щщщ" })
);
// Ч => ЩЩЩ
message = Regex.Replace(
message,
"Ч+",
_random.Pick(new List<string>() { "ЩЩ", "ЩЩЩ" })
);
// Corvax-Localization-End

args.Message = message;
}
}
29 changes: 29 additions & 0 deletions Content.Server/Speech/EntitySystems/MobsterAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@ public sealed class MobsterAccentSystem : EntitySystem

private static readonly Dictionary<string, string> DirectReplacements = new()
{
// Corvax-Localization-Start
{ "утащил", "сдёрнул" },
{ "принеси", "надыбай" },
{ "принесите", "надыбайте" },
{ "сб", "мусора" },
{ "враг", "шелупонь" },
{ "враги", "шелупонь" },
{ "тревога", "шухер" },
{ "заметили", "спалили" },
{ "оружие", "валына" },
{ "убийство", "мокруха" },
{ "убить", "замочить" },
{ "убей", "вальни" },
{ "убейте", "завалите" },
{ "еда", "жратва"},
{ "еды", "жратвы"},
{ "убили", "замаслили" },
{ "ранен", "словил маслину"},
{ "мертв", "спит с рыбами"},
{ "мёртв", "спит с рыбами"},
{ "мертва", "спит с рыбами"},
{ "хэй", "йоу" },
{ "хей", "йоу" },
{ "здесь", "здеся" },
{ "тут", "тута" },
{ "привет", "аве" },
{ "плохо", "ацтой" },
{ "хорошо", "агонь" },
// Corvax-Localization-End
{ "let me", "lemme" },
{ "should", "oughta" },
{ "the", "da" },
Expand Down
29 changes: 29 additions & 0 deletions Content.Server/Speech/EntitySystems/MothAccentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random;

namespace Content.Server.Speech.EntitySystems;

public sealed class MothAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!; // Corvax-Localization
public override void Initialize()
{
base.Initialize();
Expand All @@ -19,6 +21,33 @@ private void OnAccent(EntityUid uid, MothAccentComponent component, AccentGetEve
message = Regex.Replace(message, "z{1,3}", "zzz");
// buZZZ
message = Regex.Replace(message, "Z{1,3}", "ZZZ");

// Corvax-Localization-Start
// ж => жжж
message = Regex.Replace(
message,
"ж+",
_random.Pick(new List<string>() { "жж", "жжж" })
);
// Ж => ЖЖЖ
message = Regex.Replace(
message,
"Ж+",
_random.Pick(new List<string>() { "ЖЖ", "ЖЖЖ" })
);
// з => ссс
message = Regex.Replace(
message,
"з+",
_random.Pick(new List<string>() { "зз", "ззз" })
);
// З => CCC
message = Regex.Replace(
message,
"З+",
_random.Pick(new List<string>() { "ЗЗ", "ЗЗЗ" })
);
// Corvax-Localization-End

args.Message = message;
}
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Speech/EntitySystems/OwOAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public string Accentuate(string message)
}

return message.Replace("!", _random.Pick(Faces))
// Corvax-Localization-Start
.Replace("р", "в").Replace("Р", "В")
.Replace("л", "в").Replace("Л", "В")
// Corvax-Localization-End
.Replace("r", "w").Replace("R", "W")
.Replace("l", "w").Replace("L", "W");
}
Expand Down

0 comments on commit 34e81ff

Please sign in to comment.