Adds new disease! Tongue Twister. Also new scrambled accent. (#9393)

This commit is contained in:
Jessica M
2022-07-03 22:22:30 -07:00
committed by GitHub
parent 82504631ee
commit 0d266f3d20
6 changed files with 83 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Server.Speech.Components
{
[RegisterComponent]
public sealed class ScrambledAccentComponent : Component
{
}
}

View File

@@ -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<ScrambledAccentComponent, AccentGetEvent>(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);
}
}
}

View File

@@ -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!,

View File

@@ -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.

View File

@@ -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

View File

@@ -44,4 +44,4 @@
components:
- type: HealthAnalyzer
fake: true
disease: ActiveZombieVirus
disease: ActiveZombieVirus