2020-06-28 09:23:26 -06:00
|
|
|
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
|
|
|
|
|
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
using Robust.Server.Interfaces.Timing;
|
2018-07-26 14:26:19 -07:00
|
|
|
|
|
2020-07-06 14:27:03 -07:00
|
|
|
|
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
|
2018-07-26 14:26:19 -07:00
|
|
|
|
{
|
2020-06-28 09:23:26 -06:00
|
|
|
|
public sealed class ApcSystem : EntitySystem
|
2018-07-26 14:26:19 -07:00
|
|
|
|
{
|
2020-06-28 09:23:26 -06:00
|
|
|
|
#pragma warning disable 649
|
|
|
|
|
|
[Dependency] private readonly IPauseManager _pauseManager;
|
|
|
|
|
|
#pragma warning restore 649
|
|
|
|
|
|
|
2018-07-26 14:26:19 -07:00
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
EntityQuery = new TypeEntityQuery(typeof(ApcComponent));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2018-07-26 14:26:19 -07:00
|
|
|
|
foreach (var entity in RelevantEntities)
|
|
|
|
|
|
{
|
2020-06-28 09:23:26 -06:00
|
|
|
|
if (_pauseManager.IsEntityPaused(entity))
|
|
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
var apc = entity.GetComponent<ApcComponent>();
|
|
|
|
|
|
uniqueApcNets.Add(apc.Net);
|
|
|
|
|
|
entity.GetComponent<ApcComponent>().Update();
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var apcNet in uniqueApcNets)
|
|
|
|
|
|
{
|
|
|
|
|
|
apcNet.Update(frameTime);
|
2018-07-26 14:26:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|