Fix Cryptobolin and make it use NewStatusEffectSystem. (#40675)

* Push

* Mercury too I guess???

* Update comment

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-10-13 19:18:53 -07:00
committed by GitHub
parent b4486a5763
commit c455386ce3
5 changed files with 26 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Content.Server.Speech.Components; using Content.Server.Speech.Components;
using Content.Shared.Speech; using Content.Shared.Speech;
using Content.Shared.StatusEffectNew;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.Speech.EntitySystems namespace Content.Server.Speech.EntitySystems
@@ -15,6 +16,7 @@ namespace Content.Server.Speech.EntitySystems
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<ScrambledAccentComponent, AccentGetEvent>(OnAccent); SubscribeLocalEvent<ScrambledAccentComponent, AccentGetEvent>(OnAccent);
SubscribeLocalEvent<ScrambledAccentComponent, StatusEffectRelayedEvent<AccentGetEvent>>(OnAccentRelayed);
} }
public string Accentuate(string message) public string Accentuate(string message)
@@ -41,9 +43,14 @@ namespace Content.Server.Speech.EntitySystems
return msg; return msg;
} }
private void OnAccent(EntityUid uid, ScrambledAccentComponent component, AccentGetEvent args) private void OnAccent(Entity<ScrambledAccentComponent> entity, ref AccentGetEvent args)
{ {
args.Message = Accentuate(args.Message); args.Message = Accentuate(args.Message);
} }
private void OnAccentRelayed(Entity<ScrambledAccentComponent> entity, ref StatusEffectRelayedEvent<AccentGetEvent> args)
{
args.Args.Message = Accentuate(args.Args.Message);
}
} }
} }

View File

@@ -23,11 +23,12 @@ public sealed class SlurredSystem : SharedSlurredSystem
} }
/// <summary> /// <summary>
/// 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
/// </summary> /// </summary>
private float GetProbabilityScale(EntityUid uid) private float GetProbabilityScale(EntityUid uid)
{ {
if (!_status.TryGetMaxTime<DrunkStatusEffectComponent>(uid, out var time)) if (!_status.TryGetMaxTime<SlurredAccentComponent>(uid, out var time))
return 0; return 0;
// This is a magic number. Why this value? No clue it was made 3 years before I refactored this. // This is a magic number. Why this value? No clue it was made 3 years before I refactored this.

View File

@@ -25,3 +25,11 @@
name: slurred name: slurred
components: components:
- type: SlurredAccent - type: SlurredAccent
# Causes words your be to scrambled. Who?
- type: entity
parent: SpeechStatusEffectBase
id: StatusEffectScrambled
name: scrambled
components:
- type: ScrambledAccent

View File

@@ -211,9 +211,9 @@
damage: damage:
types: types:
Poison: 1 Poison: 1
- !type:GenericStatusEffect - !type:ModifyStatusEffect
key: Stutter effectProto: StatusEffectScrambled
component: ScrambledAccent type: Update
- type: reagent - type: reagent
id: Potassium id: Potassium

View File

@@ -11,11 +11,11 @@
metabolisms: metabolisms:
Medicine: Medicine:
effects: effects:
- !type:GenericStatusEffect
key: Stutter
component: ScrambledAccent
- !type:ModifyStatusEffect - !type:ModifyStatusEffect
effectProto: StatusEffectSlurred effectProto: StatusEffectScrambled
type: Update
- !type:ModifyStatusEffect
effectProto: StatusEffectWoozy
time: 20.0 time: 20.0
- type: reagent - type: reagent