Add readonly where it is missing and fix those field names according to their modifiers (#2589)
This commit is contained in:
@@ -29,18 +29,16 @@ namespace Content.Server.StationEvents
|
||||
|
||||
private float _elapsedTime;
|
||||
private int _failDuration;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// So we don't overlap the announcement with power-down sounds we'll delay it a few seconds.
|
||||
/// </summary>
|
||||
private bool _announced;
|
||||
|
||||
private CancellationTokenSource _announceCancelToken;
|
||||
|
||||
private List<IEntity> _powered = new List<IEntity>();
|
||||
|
||||
|
||||
|
||||
private readonly List<IEntity> _powered = new List<IEntity>();
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
@@ -49,7 +47,7 @@ namespace Content.Server.StationEvents
|
||||
_elapsedTime = 0.0f;
|
||||
_failDuration = IoCManager.Resolve<IRobustRandom>().Next(60, 120);
|
||||
var componentManager = IoCManager.Resolve<IComponentManager>();
|
||||
|
||||
|
||||
foreach (PowerReceiverComponent component in componentManager.EntityQuery<PowerReceiverComponent>())
|
||||
{
|
||||
component.PowerDisabled = true;
|
||||
@@ -64,13 +62,13 @@ namespace Content.Server.StationEvents
|
||||
foreach (var entity in _powered)
|
||||
{
|
||||
if (entity.Deleted) continue;
|
||||
|
||||
|
||||
if (entity.TryGetComponent(out PowerReceiverComponent powerReceiverComponent))
|
||||
{
|
||||
powerReceiverComponent.PowerDisabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_announceCancelToken?.Cancel();
|
||||
_announceCancelToken = new CancellationTokenSource();
|
||||
Timer.Spawn(3000, () =>
|
||||
@@ -92,7 +90,7 @@ namespace Content.Server.StationEvents
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal("/Audio/Announcements/power_off.ogg");
|
||||
_announced = true;
|
||||
}
|
||||
|
||||
|
||||
_elapsedTime += frameTime;
|
||||
|
||||
if (_elapsedTime < _failDuration)
|
||||
|
||||
Reference in New Issue
Block a user