ResetNarcolepsy.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using Content.Server.Traits.Assorted;
  2. using Content.Shared.Chemistry.Reagent;
  3. using Content.Shared.EntityEffects;
  4. using JetBrains.Annotations;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Server.EntityEffects.Effects;
  7. /// <summary>
  8. /// Reset narcolepsy timer
  9. /// </summary>
  10. [UsedImplicitly]
  11. public sealed partial class ResetNarcolepsy : EntityEffect
  12. {
  13. /// <summary>
  14. /// The # of seconds the effect resets the narcolepsy timer to
  15. /// </summary>
  16. [DataField("TimerReset")]
  17. public int TimerReset = 600;
  18. protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
  19. => Loc.GetString("reagent-effect-guidebook-reset-narcolepsy", ("chance", Probability));
  20. public override void Effect(EntityEffectBaseArgs args)
  21. {
  22. if (args is EntityEffectReagentArgs reagentArgs)
  23. if (reagentArgs.Scale != 1f)
  24. return;
  25. args.EntityManager.EntitySysManager.GetEntitySystem<NarcolepsySystem>().AdjustNarcolepsyTimer(args.TargetEntity, TimerReset);
  26. }
  27. }