diff --git a/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs b/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs index d685edc38b..2f67bfad08 100644 --- a/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs +++ b/Content.Server/Speech/EntitySystems/ScrambledAccentSystem.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Text.RegularExpressions; using Content.Server.Speech.Components; using Content.Shared.Speech; +using Content.Shared.StatusEffectNew; using Robust.Shared.Random; namespace Content.Server.Speech.EntitySystems @@ -15,6 +16,7 @@ namespace Content.Server.Speech.EntitySystems public override void Initialize() { SubscribeLocalEvent(OnAccent); + SubscribeLocalEvent>(OnAccentRelayed); } public string Accentuate(string message) @@ -41,9 +43,14 @@ namespace Content.Server.Speech.EntitySystems return msg; } - private void OnAccent(EntityUid uid, ScrambledAccentComponent component, AccentGetEvent args) + private void OnAccent(Entity entity, ref AccentGetEvent args) { args.Message = Accentuate(args.Message); } + + private void OnAccentRelayed(Entity entity, ref StatusEffectRelayedEvent args) + { + args.Args.Message = Accentuate(args.Args.Message); + } } } diff --git a/Content.Server/Speech/EntitySystems/SlurredSystem.cs b/Content.Server/Speech/EntitySystems/SlurredSystem.cs index 8690079de1..c4db77c14b 100644 --- a/Content.Server/Speech/EntitySystems/SlurredSystem.cs +++ b/Content.Server/Speech/EntitySystems/SlurredSystem.cs @@ -23,11 +23,12 @@ public sealed class SlurredSystem : SharedSlurredSystem } /// - /// Slur chance scales with "drunkeness", which is just measured using the time remaining on the status effect. + /// Slur chance scales with the time remaining on any status effect with the SlurredAccentComponent. + /// Typically, this is equivalent to "drunkenness" on the DrunkStatusEffect /// private float GetProbabilityScale(EntityUid uid) { - if (!_status.TryGetMaxTime(uid, out var time)) + if (!_status.TryGetMaxTime(uid, out var time)) return 0; // This is a magic number. Why this value? No clue it was made 3 years before I refactored this. diff --git a/Resources/Prototypes/Entities/StatusEffects/speech.yml b/Resources/Prototypes/Entities/StatusEffects/speech.yml index 17e533b1a8..1fe13c4626 100644 --- a/Resources/Prototypes/Entities/StatusEffects/speech.yml +++ b/Resources/Prototypes/Entities/StatusEffects/speech.yml @@ -25,3 +25,11 @@ name: slurred components: - type: SlurredAccent + +# Causes words your be to scrambled. Who? +- type: entity + parent: SpeechStatusEffectBase + id: StatusEffectScrambled + name: scrambled + components: + - type: ScrambledAccent diff --git a/Resources/Prototypes/Reagents/elements.yml b/Resources/Prototypes/Reagents/elements.yml index 27e27be503..401fdfd2eb 100644 --- a/Resources/Prototypes/Reagents/elements.yml +++ b/Resources/Prototypes/Reagents/elements.yml @@ -211,9 +211,9 @@ damage: types: Poison: 1 - - !type:GenericStatusEffect - key: Stutter - component: ScrambledAccent + - !type:ModifyStatusEffect + effectProto: StatusEffectScrambled + type: Update - type: reagent id: Potassium diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index d81ec12b3d..998f508b61 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -11,11 +11,11 @@ metabolisms: Medicine: effects: - - !type:GenericStatusEffect - key: Stutter - component: ScrambledAccent - !type:ModifyStatusEffect - effectProto: StatusEffectSlurred + effectProto: StatusEffectScrambled + type: Update + - !type:ModifyStatusEffect + effectProto: StatusEffectWoozy time: 20.0 - type: reagent