diff --git a/Content.Server/Speech/Components/ScrambledAccentComponent.cs b/Content.Server/Speech/Components/ScrambledAccentComponent.cs new file mode 100644 index 0000000000..d25e048ede --- /dev/null +++ b/Content.Server/Speech/Components/ScrambledAccentComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Speech.Components +{ + [RegisterComponent] + public sealed class ScrambledAccentComponent : Component + { + } +} diff --git a/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs b/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs new file mode 100644 index 0000000000..00e1a768f3 --- /dev/null +++ b/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs @@ -0,0 +1,46 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Content.Server.Speech.Components; +using Robust.Shared.Random; + +namespace Content.Server.Speech.EntitySystems +{ + public sealed class ScrambledAccentSystem : EntitySystem + { + [Dependency] private readonly IRobustRandom _random = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnAccent); + } + + public string Accentuate(string message) + { + var words = message.ToLower().Split(); + + if (words.Length < 2) + { + var pick = _random.Next(1, 8); + // If they try to weasel out of it by saying one word at a time we give them this. + return Loc.GetString($"accent-scrambled-words-{pick}"); + } + + //Scramble the words + var scrambled = words.OrderBy(x => _random.Next()).ToArray(); + + var msg = String.Join(" ", scrambled); + + //First letter should be capital + msg = msg[0].ToString().ToUpper() + msg.Remove(0, 1); + + //Capitalize lone i's + msg = Regex.Replace(msg, @"(?<=\ )i(?=[\ \.\?]|$)", "I"); + return msg; + } + + private void OnAccent(EntityUid uid, ScrambledAccentComponent component, AccentGetEvent args) + { + args.Message = Accentuate(args.Message); + } + } +} diff --git a/Resources/Locale/en-US/accent/scrambled.ftl b/Resources/Locale/en-US/accent/scrambled.ftl new file mode 100644 index 0000000000..e01f574742 --- /dev/null +++ b/Resources/Locale/en-US/accent/scrambled.ftl @@ -0,0 +1,7 @@ +accent-scrambled-words-1 = Who?, +accent-scrambled-words-2 = What?, +accent-scrambled-words-3 = When?, +accent-scrambled-words-4 = Where?, +accent-scrambled-words-5 = Why!, +accent-scrambled-words-6 = How?, +accent-scrambled-words-7 = Me!, diff --git a/Resources/Locale/en-US/disease/disease.ftl b/Resources/Locale/en-US/disease/disease.ftl index 674e1905fd..ee30b59ebf 100644 --- a/Resources/Locale/en-US/disease/disease.ftl +++ b/Resources/Locale/en-US/disease/disease.ftl @@ -10,3 +10,4 @@ disease-eaten-inside = You feel like you're being eaten from the inside. disease-banana-compulsion = You really want to eat some bananas. disease-beat-chest-compulsion = {CAPITALIZE(THE($person))} beats {POSS-ADJ($person)} chest. disease-vomit = {CAPITALIZE(THE($person))} vomits. +disease-think = You feel like you can't think straight. diff --git a/Resources/Prototypes/Diseases/infectious.yml b/Resources/Prototypes/Diseases/infectious.yml index c24fd5a2ce..b9fd3e7432 100644 --- a/Resources/Prototypes/Diseases/infectious.yml +++ b/Resources/Prototypes/Diseases/infectious.yml @@ -220,3 +220,24 @@ min: 420 ## Reachable with a flamer - !type:DiseaseReagentCure reagent: Theobromine + +- type: disease + id: TongueTwister + name: Tongue Twister + cureResist: 0.1 + effects: + - !type:DiseaseGenericStatusEffect + key: Stutter + component: ScrambledAccent + - !type:DiseaseSnough + probability: 0.01 + snoughSound: + collection: Sneezes + - !type:DiseaseSnough + probability: 0.02 + snoughMessage: disease-think + cures: + - !type:DiseaseBedrestCure + maxLength: 30 + - !type:DiseaseJustWaitCure + maxLength: 400 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml index a4cc92a4a7..a200ebb516 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml @@ -44,4 +44,4 @@ components: - type: HealthAnalyzer fake: true - disease: ActiveZombieVirus \ No newline at end of file + disease: ActiveZombieVirus