diff --git a/Content.Server/Speech/Components/ReplacementAccentComponent.cs b/Content.Server/Speech/Components/ReplacementAccentComponent.cs index e7f57b80d0..037da72029 100644 --- a/Content.Server/Speech/Components/ReplacementAccentComponent.cs +++ b/Content.Server/Speech/Components/ReplacementAccentComponent.cs @@ -22,6 +22,12 @@ namespace Content.Server.Speech.Components /// [DataField("wordReplacements")] public Dictionary? WordReplacements; + + /// + /// Allows you to substitute words, not always, but with some chance + /// + [DataField] + public float ReplacementChance = 1f; } /// @@ -33,10 +39,5 @@ namespace Content.Server.Speech.Components [DataField("accent", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] public string Accent = default!; - /// - /// Allows you to substitute words, not always, but with some chance - /// - [DataField] - public float ReplacementChance = 1f; } } diff --git a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs index da198bcc12..d81d913a36 100644 --- a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs +++ b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs @@ -24,9 +24,6 @@ namespace Content.Server.Speech.EntitySystems private void OnAccent(EntityUid uid, ReplacementAccentComponent component, AccentGetEvent args) { - if (!_random.Prob(component.ReplacementChance)) - return; - args.Message = ApplyReplacements(args.Message, component.Accent); } @@ -39,6 +36,9 @@ namespace Content.Server.Speech.EntitySystems if (!_proto.TryIndex(accent, out var prototype)) return message; + if (!_random.Prob(prototype.ReplacementChance)) + return message; + // Prioritize fully replacing if that exists-- // ideally both aren't used at the same time (but we don't have a way to enforce that in serialization yet) if (prototype.FullReplacements != null) diff --git a/Resources/Prototypes/Accents/word_replacements.yml b/Resources/Prototypes/Accents/word_replacements.yml index 30c739b845..9a801d786d 100644 --- a/Resources/Prototypes/Accents/word_replacements.yml +++ b/Resources/Prototypes/Accents/word_replacements.yml @@ -428,6 +428,7 @@ - type: accent id: liar + replacementChance: 0.15 wordReplacements: liar-word-1: liar-word-replacement-1 liar-word-2: liar-word-replacement-2 @@ -471,4 +472,4 @@ liar-word-39: liar-word-replacement-39 liar-word-40: liar-word-replacement-40 liar-word-41: liar-word-replacement-41 - liar-word-42: liar-word-replacement-42 \ No newline at end of file + liar-word-42: liar-word-replacement-42 diff --git a/Resources/Prototypes/Traits/neutral.yml b/Resources/Prototypes/Traits/neutral.yml index d1e0afc83c..78d2bba049 100644 --- a/Resources/Prototypes/Traits/neutral.yml +++ b/Resources/Prototypes/Traits/neutral.yml @@ -1,4 +1,4 @@ -- type: trait +- type: trait id: PirateAccent name: trait-pirate-accent-name description: trait-pirate-accent-desc @@ -30,5 +30,4 @@ description: trait-liar-desc components: - type: ReplacementAccent - replacementChance: 0.15 accent: liar