* Server EntitySystem cleanup I went after low-hanging fruit systems. * Add / change to internal access modifiers to systems * Use EntityQuery to get components instead * Add sealed modifier to systems * Remove unused imports * Add jetbrains annotation for unused classes * Removed some pragmas for dependencies This should also fix a decent chunk of the server build warnings, at least the ones that matter. * Also disposals * Update Content.Server/GameObjects/EntitySystems/GravitySystem.cs * Fix build Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
|
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using System.Collections.Generic;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Server.Interfaces.Timing;
|
|
|
|
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
|
|
{
|
|
[UsedImplicitly]
|
|
internal sealed class PowerApcSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
|
|
|
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 apc in ComponentManager.EntityQuery<ApcComponent>())
|
|
{
|
|
if (_pauseManager.IsEntityPaused(apc.Owner))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
uniqueApcNets.Add(apc.Net);
|
|
apc.Update();
|
|
}
|
|
|
|
foreach (var apcNet in uniqueApcNets)
|
|
{
|
|
apcNet.Update(frameTime);
|
|
}
|
|
}
|
|
}
|
|
}
|