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:
committed by
GitHub
parent
b4486a5763
commit
c455386ce3
@@ -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<ScrambledAccentComponent, AccentGetEvent>(OnAccent);
|
||||
SubscribeLocalEvent<ScrambledAccentComponent, StatusEffectRelayedEvent<AccentGetEvent>>(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<ScrambledAccentComponent> entity, ref AccentGetEvent args)
|
||||
{
|
||||
args.Message = Accentuate(args.Message);
|
||||
}
|
||||
|
||||
private void OnAccentRelayed(Entity<ScrambledAccentComponent> entity, ref StatusEffectRelayedEvent<AccentGetEvent> args)
|
||||
{
|
||||
args.Args.Message = Accentuate(args.Args.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,12 @@ public sealed class SlurredSystem : SharedSlurredSystem
|
||||
}
|
||||
|
||||
/// <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>
|
||||
private float GetProbabilityScale(EntityUid uid)
|
||||
{
|
||||
if (!_status.TryGetMaxTime<DrunkStatusEffectComponent>(uid, out var time))
|
||||
if (!_status.TryGetMaxTime<SlurredAccentComponent>(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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -211,9 +211,9 @@
|
||||
damage:
|
||||
types:
|
||||
Poison: 1
|
||||
- !type:GenericStatusEffect
|
||||
key: Stutter
|
||||
component: ScrambledAccent
|
||||
- !type:ModifyStatusEffect
|
||||
effectProto: StatusEffectScrambled
|
||||
type: Update
|
||||
|
||||
- type: reagent
|
||||
id: Potassium
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user