PowerGridCheckRuleComponent.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.Threading;
  2. using Content.Server.StationEvents.Events;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.StationEvents.Components;
  6. [RegisterComponent, Access(typeof(PowerGridCheckRule))]
  7. public sealed partial class PowerGridCheckRuleComponent : Component
  8. {
  9. /// <summary>
  10. /// Default sound of the announcement when power is back on.
  11. /// </summary>
  12. private static readonly ProtoId<SoundCollectionPrototype> DefaultPowerOn = new("PowerOn");
  13. /// <summary>
  14. /// Sound of the announcement to play when power is back on.
  15. /// </summary>
  16. [DataField]
  17. public SoundSpecifier PowerOnSound = new SoundCollectionSpecifier(DefaultPowerOn, AudioParams.Default.WithVolume(-4f));
  18. public CancellationTokenSource? AnnounceCancelToken;
  19. public EntityUid AffectedStation;
  20. public readonly List<EntityUid> Powered = new();
  21. public readonly List<EntityUid> Unpowered = new();
  22. public float SecondsUntilOff = 30.0f;
  23. public int NumberPerSecond = 0;
  24. public float UpdateRate => 1.0f / NumberPerSecond;
  25. public float FrameTimeAccumulator = 0.0f;
  26. }