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:
parent
149bc046fd
commit
27263892ef
|
|
@ -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 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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue