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

Фикс акцентов #289

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Content.Server/Speech/EntitySystems/BarkAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public string Accentuate(string message)
}

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

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

namespace Content.Server.Speech.EntitySystems;

Expand All @@ -12,6 +13,8 @@ public sealed class FrontalLispSystem : EntitySystem
private static readonly Regex RegexLowerEcks = new(@"[e]+[x]+[c]*|[x]+");
// @formatter:on

[Dependency] private readonly IRobustRandom _random = default!; // Corvax-Localization

public override void Initialize()
{
base.Initialize();
Expand All @@ -29,6 +32,15 @@ private void OnAccent(EntityUid uid, FrontalLispComponent component, AccentGetEv
message = RegexUpperEcks.Replace(message, "EKTH");
message = RegexLowerEcks.Replace(message, "ekth");

// Corvax-Localization Start
// с, в, ч, т in ф or ш
message = Regex.Replace(message, @"\B[СВЧТ]\B", _random.Prob(0.5f) ? "Ф" : "Ш");
message = Regex.Replace(message, @"\B[свчт]\B", _random.Prob(0.5f) ? "ф" : "ш");
// д in ф
message = Regex.Replace(message, @"\b[Д](?![ИЕЁЮЯЬ])\b|\B[Д]\B", "Ф");
message = Regex.Replace(message, @"\b[Дд](?![ИиЕеЁёЮюЯяЬь])\b|\B[Дд]\B", "ф");
// Corvax-Localization End

args.Message = message;
}
}
10 changes: 5 additions & 5 deletions Content.Server/Speech/EntitySystems/MonkeyAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ public string Accentuate(string message)
{
foreach (var _ in word)
{
accentedMessage.Append('O');
accentedMessage.Append('У'); // Corvax-Localization
}

if (_random.NextDouble() >= 0.3)
accentedMessage.Append('K');
accentedMessage.Append('К'); // Corvax-Localization
}
else
accentedMessage.Append('O');
accentedMessage.Append('У'); // Corvax-Localization
}
else
{
foreach (var _ in word)
{
if (_random.NextDouble() >= 0.8)
accentedMessage.Append('H');
accentedMessage.Append('Г'); // Corvax-Localization
else
accentedMessage.Append('A');
accentedMessage.Append('А'); // Corvax-Localization
}

}
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Speech/EntitySystems/OwOAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public sealed class OwOAccentSystem : EntitySystem
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
{
{ "you", "wu" },
{ "ты", "ти" }, // Corvax-Localization
};

public override void Initialize()
Expand Down
8 changes: 7 additions & 1 deletion Content.Server/Speech/EntitySystems/SlurredSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ private string Accentuate(string message, float scale)
'a' => "ah",
'u' => "oo",
'c' => "k",
// Corvax-Localization Start
'о' => "а",
'к' => "кх",
'щ' => "шч",
'ц' => "тс",
// Corvax-Localization End
_ => $"{character}",
};

Expand All @@ -90,7 +96,7 @@ private string Accentuate(string message, float scale)
}
}

if (!_random.Prob(scale * 3/20))
if (!_random.Prob(scale * 3 / 20))
{
sb.Append(character);
continue;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Speech/EntitySystems/StutteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class StutteringSystem : SharedStutteringSystem
[Dependency] private readonly IRobustRandom _random = default!;

// Regex of characters to stutter.
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz]",
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz-б-вд-к-лмн-прст]", // Corvax-Localization
RegexOptions.Compiled | RegexOptions.IgnoreCase);

public override void Initialize()
Expand Down
Loading