Narcolepsy Treatment (#13427)
* ResetNarcolepsy.cs and NarcolepsySystem.cs changes * fix multiple narcolepsy incidents * comment * Update Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs Co-authored-by: 0x6273 <0x40@keemail.me> * try to fix tests Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
26
Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs
Normal file
26
Content.Server/Chemistry/ReagentEffects/ResetNarcolepsy.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Content.Server.Traits.Assorted;
|
||||||
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
|
namespace Content.Server.Chemistry.ReagentEffects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset narcolepsy timer
|
||||||
|
/// </summary>
|
||||||
|
[UsedImplicitly]
|
||||||
|
public sealed class ResetNarcolepsy : ReagentEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The # of seconds the effect resets the narcolepsy timer to
|
||||||
|
/// </summary>
|
||||||
|
[DataField("TimerReset")]
|
||||||
|
public int TimerReset = 600;
|
||||||
|
|
||||||
|
public override void Effect(ReagentEffectArgs args)
|
||||||
|
{
|
||||||
|
if (args.Scale != 1f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.EntityManager.EntitySysManager.GetEntitySystem<NarcolepsySystem>().AdjustNarcolepsyTimer(args.SolutionEntity, TimerReset);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.Bed.Sleep;
|
using Content.Shared.Bed.Sleep;
|
||||||
using Content.Shared.StatusEffect;
|
using Content.Shared.StatusEffect;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -26,6 +26,14 @@ public sealed class NarcolepsySystem : EntitySystem
|
|||||||
_random.NextFloat(component.TimeBetweenIncidents.X, component.TimeBetweenIncidents.Y);
|
_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)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
key: KnockedDown
|
key: KnockedDown
|
||||||
time: 3
|
time: 3
|
||||||
type: Remove
|
type: Remove
|
||||||
|
Medicine:
|
||||||
|
effects:
|
||||||
|
- !type:ResetNarcolepsy
|
||||||
|
conditions:
|
||||||
|
- !type:ReagentThreshold
|
||||||
|
min: 5
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: Ephedrine
|
id: Ephedrine
|
||||||
@@ -79,6 +85,12 @@
|
|||||||
messages: ["ephedrine-effect-tight-pain", "ephedrine-effect-heart-pounds"]
|
messages: ["ephedrine-effect-tight-pain", "ephedrine-effect-heart-pounds"]
|
||||||
type: Local
|
type: Local
|
||||||
probability: 0.05
|
probability: 0.05
|
||||||
|
Medicine:
|
||||||
|
effects:
|
||||||
|
- !type:ResetNarcolepsy
|
||||||
|
conditions:
|
||||||
|
- !type:ReagentThreshold
|
||||||
|
min: 10
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: THC
|
id: THC
|
||||||
|
|||||||
Reference in New Issue
Block a user