Power Rework (#863)

Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
py01
2020-06-28 09:23:26 -06:00
committed by GitHub
parent ffe25de723
commit 23cc6b1d4e
154 changed files with 11253 additions and 3913 deletions

View File

@@ -1,11 +1,19 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using System.Collections.Generic;
using Robust.Shared.IoC;
using Robust.Server.Interfaces.Timing;
namespace Content.Server.GameObjects.EntitySystems
{
class PowerApcSystem : EntitySystem
public sealed class ApcSystem : EntitySystem
{
#pragma warning disable 649
[Dependency] private readonly IPauseManager _pauseManager;
#pragma warning restore 649
public override void Initialize()
{
EntityQuery = new TypeEntityQuery(typeof(ApcComponent));
@@ -13,10 +21,20 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Update(float frameTime)
{
var uniqueApcNets = new HashSet<IApcNet>(); //could be improved by maintaining set instead of getting collection every frame
foreach (var entity in RelevantEntities)
{
var comp = entity.GetComponent<ApcComponent>();
comp.OnUpdate();
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);
}
}
}