diff --git a/Content.Server/SS220/Speech/Components/VoxAccentComponent.cs b/Content.Server/SS220/Speech/Components/VoxAccentComponent.cs new file mode 100644 index 00000000000000..9b897bbf6b8a82 --- /dev/null +++ b/Content.Server/SS220/Speech/Components/VoxAccentComponent.cs @@ -0,0 +1,11 @@ +// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt + +namespace Content.Server.SS220.Speech.Components; + +/// +/// The vox accent component. Changes "k" to "kk" or "kek", and "ch" to "ch" or "chech" +/// +[RegisterComponent] +public sealed partial class VoxAccentComponent : Component +{ +} diff --git a/Content.Server/SS220/Speech/EntitySystems/VoxAccentSystem.cs b/Content.Server/SS220/Speech/EntitySystems/VoxAccentSystem.cs new file mode 100644 index 00000000000000..5bfa275b8c475f --- /dev/null +++ b/Content.Server/SS220/Speech/EntitySystems/VoxAccentSystem.cs @@ -0,0 +1,53 @@ +// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt + +using System.Text.RegularExpressions; +using Robust.Shared.Random; +using Content.Server.SS220.Speech.Components; +using Content.Server.Speech; + +namespace Content.Server.SS220.Speech.EntitySystems; + +public sealed class VoxAccentSystem : EntitySystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + + private static readonly Regex RegexLowerK = new("k+"); + private static readonly Regex RegexUpperK = new("K+"); + private static readonly Regex RegexRuLowerK = new("к+"); + private static readonly Regex RegexRuUpperK = new("К+"); + private static readonly Regex RegexLowerCH = new("ch+"); + private static readonly Regex RegexUpperCH = new("CH+"); + private static readonly Regex RegexRuLowerCH = new("ч+"); + private static readonly Regex RegexRuUpperCH = new("Ч+"); + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnAccent); + } + + private void OnAccent(Entity entity, ref AccentGetEvent args) + { + var message = args.Message; + + // k into kk or kek + message = RegexLowerK.Replace(message, _random.Pick(new List() { "kk", "kek" })); + // K into KK or KEK + message = RegexUpperK.Replace(message, _random.Pick(new List() { "KK", "KEK" })); + // к в кк или кик + message = RegexRuLowerK.Replace(message, _random.Pick(new List() { "кк", "кик" })); + // К в КК или КИК + message = RegexRuUpperK.Replace(message, _random.Pick(new List() { "КК", "КИК" })); + + // ch into chch or chech + message = RegexLowerCH.Replace(message, _random.Pick(new List() { "chch", "chech" })); + // CH into CHCH or CHECH + message = RegexUpperCH.Replace(message, _random.Pick(new List() { "CHCH", "CHECH" })); + // ч в чч или чич + message = RegexRuLowerCH.Replace(message, _random.Pick(new List() { "чч", "чич" })); + // Ч в ЧЧ или ЧИЧ + message = RegexRuUpperCH.Replace(message, _random.Pick(new List() { "ЧЧ", "ЧИЧ" })); + + args.Message = message; + } +} diff --git a/Resources/Prototypes/Entities/Mobs/Species/vox.yml b/Resources/Prototypes/Entities/Mobs/Species/vox.yml index f0ad394d87f4ed..a3fddc8b7de1fc 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/vox.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/vox.yml @@ -29,6 +29,7 @@ spawned: - id: FoodMeatChicken amount: 5 + - type: VoxAccent #SS220-Vox Accent - type: Damageable damageContainer: Biological damageModifierSet: Vox diff --git a/Resources/Prototypes/Traits/speech.yml b/Resources/Prototypes/Traits/speech.yml index fd296ed56ac40d..e716c585946396 100644 --- a/Resources/Prototypes/Traits/speech.yml +++ b/Resources/Prototypes/Traits/speech.yml @@ -14,6 +14,10 @@ - type: OwOAccent #SS220 - type: ReplacementAccent accent: dwarf + #SS220-Vox accent Begin + - type: TajaranAccent + - type: VoxAccent + #SS220-Vox accent End # 1 Cost