diff --git a/Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs b/Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs new file mode 100644 index 0000000000..eeaffb8149 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs @@ -0,0 +1,26 @@ +using Content.Server.Traits.Assorted; +using Content.Shared.Chemistry.Reagent; +using JetBrains.Annotations; + +namespace Content.Server.Chemistry.ReagentEffects; + +/// +/// Reset narcolepsy timer +/// +[UsedImplicitly] +public sealed class ResetNarcolepsy : ReagentEffect +{ + /// + /// The # of seconds the effect resets the narcolepsy timer to + /// + [DataField("TimerReset")] + public int TimerReset = 600; + + public override void Effect(ReagentEffectArgs args) + { + if (args.Scale != 1f) + return; + + args.EntityManager.EntitySysManager.GetEntitySystem().AdjustNarcolepsyTimer(args.SolutionEntity, TimerReset); + } +} diff --git a/Content.Server/Traits/Assorted/NarcolepsySystem.cs b/Content.Server/Traits/Assorted/NarcolepsySystem.cs index 0d4bb90710..37ce88e385 100644 --- a/Content.Server/Traits/Assorted/NarcolepsySystem.cs +++ b/Content.Server/Traits/Assorted/NarcolepsySystem.cs @@ -1,4 +1,4 @@ -using Content.Shared.Bed.Sleep; +using Content.Shared.Bed.Sleep; using Content.Shared.StatusEffect; using Robust.Shared.Random; @@ -26,6 +26,14 @@ public sealed class NarcolepsySystem : EntitySystem _random.NextFloat(component.TimeBetweenIncidents.X, component.TimeBetweenIncidents.Y); } + public void AdjustNarcolepsyTimer(EntityUid uid, int TimerReset, NarcolepsyComponent? narcolepsy = null) + { + if (!Resolve(uid, ref narcolepsy, false)) + return; + + narcolepsy.NextIncidentTime = TimerReset; + } + public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Resources/Prototypes/Reagents/narcotics.yml b/Resources/Prototypes/Reagents/narcotics.yml index 7b96e8c4fb..cc4266d0a2 100644 --- a/Resources/Prototypes/Reagents/narcotics.yml +++ b/Resources/Prototypes/Reagents/narcotics.yml @@ -40,6 +40,12 @@ key: KnockedDown time: 3 type: Remove + Medicine: + effects: + - !type:ResetNarcolepsy + conditions: + - !type:ReagentThreshold + min: 5 - type: reagent id: Ephedrine @@ -79,6 +85,12 @@ messages: ["ephedrine-effect-tight-pain", "ephedrine-effect-heart-pounds"] type: Local probability: 0.05 + Medicine: + effects: + - !type:ResetNarcolepsy + conditions: + - !type:ReagentThreshold + min: 10 - type: reagent id: THC