[tweak] accent adaptation
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Components;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Speech.EntitySystems;
|
namespace Content.Server.Speech.EntitySystems;
|
||||||
|
|
||||||
public sealed class LizardAccentSystem : EntitySystem
|
public sealed class LizardAccentSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -26,6 +29,60 @@ public sealed class LizardAccentSystem : EntitySystem
|
|||||||
// eckS
|
// eckS
|
||||||
message = Regex.Replace(message, @"\bX([\-|r|R]|\b)", "ECKS$1");
|
message = Regex.Replace(message, @"\bX([\-|r|R]|\b)", "ECKS$1");
|
||||||
|
|
||||||
|
|
||||||
|
//WD-EDIT
|
||||||
|
|
||||||
|
// 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>() { "Щщ", "Щщщ" })
|
||||||
|
);
|
||||||
|
|
||||||
|
//WD-EDIT
|
||||||
|
|
||||||
args.Message = message;
|
args.Message = message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,23 +28,23 @@ public sealed class MonkeyAccentSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
foreach (var _ in word)
|
foreach (var _ in word)
|
||||||
{
|
{
|
||||||
accentedMessage.Append('O');
|
accentedMessage.Append('У'); //WD-EDIT
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_random.NextDouble() >= 0.3)
|
if (_random.NextDouble() >= 0.3)
|
||||||
accentedMessage.Append('K');
|
accentedMessage.Append('К'); //WD-EDIT
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
accentedMessage.Append('O');
|
accentedMessage.Append('У'); //WD-EDIT
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var _ in word)
|
foreach (var _ in word)
|
||||||
{
|
{
|
||||||
if (_random.NextDouble() >= 0.8)
|
if (_random.NextDouble() >= 0.8)
|
||||||
accentedMessage.Append('H');
|
accentedMessage.Append('Г'); //WD-EDIT
|
||||||
else
|
else
|
||||||
accentedMessage.Append('A');
|
accentedMessage.Append('А'); //WD-EDIT
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,17 @@ namespace Content.Server.Speech.EntitySystems
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
private static readonly IReadOnlyList<string> Faces = new List<string>{
|
private static readonly IReadOnlyList<string> Faces = new List<string>{
|
||||||
" (・`ω´・)", " ;;w;;", " owo", " UwU", " >w<", " ^w^"
|
//WD-EDIT
|
||||||
|
" (`ω´)", " ;;w;;", " owo", " UwU", " >w<", " ^w^"
|
||||||
|
//WD-EDIT
|
||||||
}.AsReadOnly();
|
}.AsReadOnly();
|
||||||
|
|
||||||
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
|
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
{ "you", "wu" },
|
{ "you", "wu" },
|
||||||
|
//WD-EDIT
|
||||||
|
{ "ты", "ти" }
|
||||||
|
//WD-EDIT
|
||||||
};
|
};
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -30,7 +35,12 @@ namespace Content.Server.Speech.EntitySystems
|
|||||||
|
|
||||||
return message.Replace("!", _random.Pick(Faces))
|
return message.Replace("!", _random.Pick(Faces))
|
||||||
.Replace("r", "w").Replace("R", "W")
|
.Replace("r", "w").Replace("R", "W")
|
||||||
.Replace("l", "w").Replace("L", "W");
|
.Replace("l", "w").Replace("L", "W")
|
||||||
|
|
||||||
|
//WD-EDIT
|
||||||
|
.Replace("р", "в").Replace("Р", "В")
|
||||||
|
.Replace("л", "в").Replace("Л", "В");
|
||||||
|
//WD-EDIT
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAccent(EntityUid uid, OwOAccentComponent component, AccentGetEvent args)
|
private void OnAccent(EntityUid uid, OwOAccentComponent component, AccentGetEvent args)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Server.Speech.EntitySystems
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
// Regex of characters to stutter.
|
// 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-б-вд-к-лмн-прст]", // WD-EDIT
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
|
|||||||
@@ -78,17 +78,17 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem
|
|||||||
|
|
||||||
if (listing.Count == 0)
|
if (listing.Count == 0)
|
||||||
{
|
{
|
||||||
GeneralStationRecordConsoleState state = new(null, null, null, console.Filter);
|
GeneralStationRecordConsoleState state = new(null, null, null, console!.Filter);
|
||||||
SetStateForInterface(uid, state);
|
SetStateForInterface(uid, state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (listing.Count == 1)
|
else if (listing.Count == 1)
|
||||||
{
|
{
|
||||||
console.ActiveKey = listing.Keys.First();
|
console!.ActiveKey = listing.Keys.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralStationRecord? record = null;
|
GeneralStationRecord? record = null;
|
||||||
if (console.ActiveKey != null)
|
if (console!.ActiveKey != null)
|
||||||
{
|
{
|
||||||
_stationRecordsSystem.TryGetRecord(owningStation.Value, _stationRecordsSystem.Convert(console.ActiveKey.Value), out record,
|
_stationRecordsSystem.TryGetRecord(owningStation.Value, _stationRecordsSystem.Convert(console.ActiveKey.Value), out record,
|
||||||
stationRecordsComponent);
|
stationRecordsComponent);
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ namespace Content.Shared.Localizations
|
|||||||
[Dependency] private readonly ILocalizationManager _loc = default!;
|
[Dependency] private readonly ILocalizationManager _loc = default!;
|
||||||
|
|
||||||
// If you want to change your codebase's language, do it here.
|
// If you want to change your codebase's language, do it here.
|
||||||
|
|
||||||
|
// WD-EDIT
|
||||||
private const string Culture = "ru-RU";
|
private const string Culture = "ru-RU";
|
||||||
|
|
||||||
|
// WD-EDIT
|
||||||
private const string FallbackCulture = "en-US";
|
private const string FallbackCulture = "en-US";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,12 +31,18 @@ namespace Content.Shared.Localizations
|
|||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
var culture = new CultureInfo(Culture);
|
var culture = new CultureInfo(Culture);
|
||||||
|
|
||||||
|
// WD-EDIT
|
||||||
var fallbackCulture = new CultureInfo(FallbackCulture);
|
var fallbackCulture = new CultureInfo(FallbackCulture);
|
||||||
|
|
||||||
|
|
||||||
_loc.LoadCulture(culture);
|
_loc.LoadCulture(culture);
|
||||||
|
|
||||||
|
// WD-EDIT
|
||||||
_loc.LoadCulture(fallbackCulture);
|
_loc.LoadCulture(fallbackCulture);
|
||||||
_loc.SetFallbackCluture(fallbackCulture);
|
_loc.SetFallbackCluture(fallbackCulture);
|
||||||
|
// WD-EDIT
|
||||||
|
|
||||||
_loc.AddFunction(culture, "PRESSURE", FormatPressure);
|
_loc.AddFunction(culture, "PRESSURE", FormatPressure);
|
||||||
_loc.AddFunction(culture, "POWERWATTS", FormatPowerWatts);
|
_loc.AddFunction(culture, "POWERWATTS", FormatPowerWatts);
|
||||||
_loc.AddFunction(culture, "POWERJOULES", FormatPowerJoules);
|
_loc.AddFunction(culture, "POWERJOULES", FormatPowerJoules);
|
||||||
|
|||||||
Reference in New Issue
Block a user