2020-08-13 14:40:27 +02:00
|
|
|
|
using System.Collections.Generic;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
2020-08-13 22:17:12 +10:00
|
|
|
|
using JetBrains.Annotations;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
using Robust.Server.Interfaces.Timing;
|
2020-08-13 14:40:27 +02:00
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
|
|
|
|
|
using Robust.Shared.IoC;
|
2018-07-26 14:26:19 -07:00
|
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
2018-07-26 14:26:19 -07:00
|
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
|
internal sealed class PowerApcSystem : EntitySystem
|
2018-07-26 14:26:19 -07:00
|
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
|
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
2018-07-26 14:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
|
{
|
2020-06-28 09:23:26 -06:00
|
|
|
|
var uniqueApcNets = new HashSet<IApcNet>(); //could be improved by maintaining set instead of getting collection every frame
|
2020-08-13 22:17:12 +10:00
|
|
|
|
foreach (var apc in ComponentManager.EntityQuery<ApcComponent>())
|
2018-07-26 14:26:19 -07:00
|
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
|
if (_pauseManager.IsEntityPaused(apc.Owner))
|
2020-06-28 09:23:26 -06:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2020-08-13 22:17:12 +10:00
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
uniqueApcNets.Add(apc.Net);
|
2020-08-13 22:17:12 +10:00
|
|
|
|
apc.Update();
|
2020-06-28 09:23:26 -06:00
|
|
|
|
}
|
2020-08-13 22:17:12 +10:00
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
foreach (var apcNet in uniqueApcNets)
|
|
|
|
|
|
{
|
|
|
|
|
|
apcNet.Update(frameTime);
|
2018-07-26 14:26:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|