diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 10d4bd56ab8..71e7a21cb41 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -21,6 +21,9 @@ + + + diff --git a/Content.Server/_Funkystation/Speech/Components/BostonAccentComponent.cs b/Content.Server/_Funkystation/Speech/Components/BostonAccentComponent.cs new file mode 100644 index 00000000000..4c58c09adb0 --- /dev/null +++ b/Content.Server/_Funkystation/Speech/Components/BostonAccentComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Speech.Components +{ + [RegisterComponent] + public sealed partial class BostonAccentComponent : Component + { + } +} diff --git a/Content.Server/_Funkystation/Speech/Components/CakAccentComponent.cs b/Content.Server/_Funkystation/Speech/Components/CakAccentComponent.cs new file mode 100644 index 00000000000..5b5e90057ac --- /dev/null +++ b/Content.Server/_Funkystation/Speech/Components/CakAccentComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Speech.Components +{ + [RegisterComponent] + public sealed partial class CakAccentComponent : Component + { + } +} diff --git a/Content.Server/_Funkystation/Speech/Components/ScandinavianAccentComponent.cs b/Content.Server/_Funkystation/Speech/Components/ScandinavianAccentComponent.cs new file mode 100644 index 00000000000..d8063c169d4 --- /dev/null +++ b/Content.Server/_Funkystation/Speech/Components/ScandinavianAccentComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Speech.Components +{ + [RegisterComponent] + public sealed partial class ScandinavianAccentComponent : Component + { + } +} diff --git a/Content.Server/_Funkystation/Speech/EntitySystems/BostonAccentSystem.cs b/Content.Server/_Funkystation/Speech/EntitySystems/BostonAccentSystem.cs new file mode 100644 index 00000000000..3699491fba6 --- /dev/null +++ b/Content.Server/_Funkystation/Speech/EntitySystems/BostonAccentSystem.cs @@ -0,0 +1,62 @@ +using Content.Server.Speech.Components; +using System.Text.RegularExpressions; +using Content.Shared.Speech; + +namespace Content.Server.Speech.EntitySystems; + +public sealed class BostonAccentSystem : EntitySystem +{ + private static readonly Regex RegexLowercaseAr = new(@"\Bar(?!e\b)"); + private static readonly Regex RegexUppercaseAr = new(@"\BAR(?!E\b)"); + private static readonly Regex RegexLowercaseEr = new(@"er\B"); + private static readonly Regex RegexUppercaseEr = new(@"ER\B"); + private static readonly Regex RegexSentenceCaseEr = new(@"Er\B"); + private static readonly Regex RegexLowercaseEndingEr = new(@"\Ber(?=(s\b|\b))"); + private static readonly Regex RegexUppercaseEndingEr = new(@"\BER(?=(s\b|\b))"); + private static readonly Regex RegexLowercaseEndingOr = new(@"\Bor(?=(s\b|\b))"); + private static readonly Regex RegexUppercaseEndingOr = new(@"\BOR(?=(s\b|\b))"); + private static readonly Regex RegexLowercaseNty = new(@"\Bnt(?=(y|ie))"); + private static readonly Regex RegexUppercaseNty = new(@"\BNT(?=(Y|IE))"); + private static readonly Regex RegexApostropheT = new(@"'t", RegexOptions.IgnoreCase); + + public override void Initialize() + { + SubscribeLocalEvent(OnAccent); + } + + public string Accentuate(string message) + { + var msg = message; + + // start -> staht + // this doesn't change "are" because that feels wrong to me + msg = RegexLowercaseAr.Replace(msg, "ah"); + msg = RegexUppercaseAr.Replace(msg, "AH"); + + // error -> ehror + msg = RegexLowercaseEr.Replace(msg, "eh"); + msg = RegexUppercaseEr.Replace(msg, "EH"); + msg = RegexSentenceCaseEr.Replace(msg, "Eh"); + + // meter -> metah + msg = RegexLowercaseEndingEr.Replace(msg, "ah"); + msg = RegexUppercaseEndingEr.Replace(msg, "AH"); + + // reactor -> reactah + msg = RegexLowercaseEndingOr.Replace(msg, "ah"); + msg = RegexUppercaseEndingOr.Replace(msg, "AH"); + + // bounty -> bounny + msg = RegexLowercaseNty.Replace(msg, "nn"); + msg = RegexUppercaseNty.Replace(msg, "NN"); + + // don't -> don' + msg = RegexApostropheT.Replace(msg, "'"); + + return msg; + } + private void OnAccent(Entity ent, ref AccentGetEvent args) + { + args.Message = Accentuate(args.Message); + } +} diff --git a/Content.Server/_Funkystation/Speech/EntitySystems/CakAccentSystem.cs b/Content.Server/_Funkystation/Speech/EntitySystems/CakAccentSystem.cs new file mode 100644 index 00000000000..2c6dda48f1b --- /dev/null +++ b/Content.Server/_Funkystation/Speech/EntitySystems/CakAccentSystem.cs @@ -0,0 +1,40 @@ +using Content.Server.Speech.Components; +using System.Text.RegularExpressions; +using Content.Shared.Speech; + +namespace Content.Server.Speech.EntitySystems; + +public sealed class CakAccentSystem : EntitySystem +{ + [Dependency] private readonly ReplacementAccentSystem _replacement = default!; + + private static readonly Regex RegexWhitespace = new(@"\s"); + + public override void Initialize() + { + SubscribeLocalEvent(OnAccent, before: new[] {typeof(OwOAccentSystem)}); + } + + public string Accentuate(string message) + { + // This is atrocious but makes sure that the word is not part of a longer sentence. + if (RegexWhitespace.Count(message) == 2) + { + message = _replacement.ApplyReplacements(message, "cak2spaces"); + } + else if (RegexWhitespace.Count(message) == 1) + { + message = _replacement.ApplyReplacements(message, "cak1space"); + } + else if (RegexWhitespace.Count(message) == 0) + { + message = _replacement.ApplyReplacements(message, "cak0spaces"); + } + return message; + } + + private void OnAccent(Entity ent, ref AccentGetEvent args) + { + args.Message = Accentuate(args.Message); + } +} diff --git a/Content.Server/_Funkystation/Speech/EntitySystems/ScandinavianAccentSystem.cs b/Content.Server/_Funkystation/Speech/EntitySystems/ScandinavianAccentSystem.cs new file mode 100644 index 00000000000..dbe02f361f5 --- /dev/null +++ b/Content.Server/_Funkystation/Speech/EntitySystems/ScandinavianAccentSystem.cs @@ -0,0 +1,96 @@ +using System.Text; +using Content.Server.Speech.Components; +using Robust.Shared.Random; +using System.Text.RegularExpressions; +using Content.Shared.Speech; + +namespace Content.Server.Speech.EntitySystems; + +public sealed class ScandinavianAccentSystem : EntitySystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + + private static readonly Regex RegexLowercaseAe = new(@"ae"); + private static readonly Regex RegexUppercaseAe = new(@"A(?i)e"); + private static readonly Regex RegexLowercaseTh = new(@"th"); + private static readonly Regex RegexUppercaseTh = new(@"T(?i)h"); + + public override void Initialize() + { + SubscribeLocalEvent(OnAccent); + } + + public string Accentuate(string message) + { + message = RegexLowercaseAe.Replace(message, "æ"); + message = RegexUppercaseAe.Replace(message, "Æ"); + message = RegexLowercaseTh.Replace(message, "ð"); + message = RegexUppercaseTh.Replace(message, "Ð"); + + + var messageBuilder = new StringBuilder(message); + + // SHITCODE INCOMING. "A" and "O" have a 50% chance to be replaced with an accented equivalent. "E" has a 25% chance to be replaced with "Æ". + for (var i = 0; i < messageBuilder.Length; i++) + { + var random_int = _random.Next(0,4); + switch (messageBuilder[i]) + { + case 'A': + messageBuilder[i] = random_int switch + { + 0 => 'Å', + 1 => 'Ä', + _ => 'A' + }; + break; + case 'a': + messageBuilder[i] = random_int switch + { + 0 => 'å', + 1 => 'ä', + _ => 'a' + }; + break; + case 'E': + messageBuilder[i] = random_int switch + { + 0 => 'Æ', + _ => 'E' + }; + break; + case 'e': + messageBuilder[i] = random_int switch + { + 0 => 'æ', + _ => 'e' + }; + break; + case 'O': + messageBuilder[i] = random_int switch + { + 0 => 'Ø', + 1 => 'Ö', + _ => 'O' + }; + break; + case 'o': + messageBuilder[i] = random_int switch + { + 0 => 'ø', + 1 => 'ö', + _ => 'o' + }; + break; + default: + break; + } + } + + return messageBuilder.ToString(); + } + private void OnAccent(Entity ent, ref AccentGetEvent args) + { + args.Message = Accentuate(args.Message); + } +} diff --git a/Resources/Locale/en-US/_Funkystation/accent/cak.ftl b/Resources/Locale/en-US/_Funkystation/accent/cak.ftl new file mode 100644 index 00000000000..d3dc7fa2edc --- /dev/null +++ b/Resources/Locale/en-US/_Funkystation/accent/cak.ftl @@ -0,0 +1,14 @@ +accent-cak-words-1 = goodbye +accent-cak-words-1-2 = bye-bye +accent-cak-words-1-3 = bye +accent-cak-words-1-4 = farewell + +accent-cak-words-2 = bye bye +accent-cak-words-2-2 = see you +accent-cak-words-2-3 = see ya +accent-cak-words-2-4 = so long + +accent-cak-words-3 = see you later +accent-cak-words-3-2 = see ya later + +accent-cak-words-replace = I'm out this bitch diff --git a/Resources/Locale/en-US/_Funkystation/traits/traits.ftl b/Resources/Locale/en-US/_Funkystation/traits/traits.ftl new file mode 100644 index 00000000000..b458d214553 --- /dev/null +++ b/Resources/Locale/en-US/_Funkystation/traits/traits.ftl @@ -0,0 +1,5 @@ +trait-boston-name = Boston accent +trait-boston-desc = You sound like you need to pahk your cah in the yahd. + +trait-scandinavian-name = Scandinavian accent +trait-scandinavian-desc = Yøu sound like yøu cöme frøm søme nondescript norðern Euröpæän nation. Ör you'ræ a Viking! diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/cake.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/cake.yml index 1b68e9b8237..b55bebdf9ab 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/cake.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/cake.yml @@ -1134,6 +1134,7 @@ settings: short - type: GhostTakeoverAvailable - type: OwOAccent + - type: CakAccent # Funky - type: Speech speechSounds: Cat speechVerb: SmallMob diff --git a/Resources/Prototypes/_Funkystation/Accents/word_replacements.yml b/Resources/Prototypes/_Funkystation/Accents/word_replacements.yml new file mode 100644 index 00000000000..ff9a27a26bf --- /dev/null +++ b/Resources/Prototypes/_Funkystation/Accents/word_replacements.yml @@ -0,0 +1,21 @@ +- type: accent + id: cak0spaces + wordReplacements: + accent-cak-words-1: accent-cak-words-replace + accent-cak-words-1-2: accent-cak-words-replace + accent-cak-words-1-3: accent-cak-words-replace + accent-cak-words-1-4: accent-cak-words-replace + +- type: accent + id: cak1space + wordReplacements: + accent-cak-words-2: accent-cak-words-replace + accent-cak-words-2-2: accent-cak-words-replace + accent-cak-words-2-3: accent-cak-words-replace + accent-cak-words-2-4: accent-cak-words-replace + +- type: accent + id: cak2spaces + wordReplacements: + accent-cak-words-3: accent-cak-words-replace + accent-cak-words-3-2: accent-cak-words-replace diff --git a/Resources/Prototypes/_Funkystation/Traits/speech.yml b/Resources/Prototypes/_Funkystation/Traits/speech.yml new file mode 100644 index 00000000000..29cbb07fe6b --- /dev/null +++ b/Resources/Prototypes/_Funkystation/Traits/speech.yml @@ -0,0 +1,17 @@ +- type: trait + id: BostonAccent + name: trait-boston-name + description: trait-boston-desc + category: SpeechTraits + cost: 1 + components: + - type: BostonAccent + +- type: trait + id: ScandinavianAccent + name: trait-scandinavian-name + description: trait-scandinavian-desc + category: SpeechTraits + cost: 1 + components: + - type: ScandinavianAccent