From 8a2e0ed14288e4f1ecb2530e60183d47c7aa9341 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 26 Oct 2020 22:07:11 +1100 Subject: [PATCH] Refactor pauses (#2215) * Refactor pauses * The last of the physics Co-authored-by: Metal Gear Sloth --- .../GameObjects/EntitySystems/BatteryDischargerSystem.cs | 7 +------ .../GameObjects/EntitySystems/BatteryStorageSystem.cs | 7 +------ Content.Server/GameObjects/EntitySystems/MoverSystem.cs | 4 ++-- .../GameObjects/EntitySystems/PowerApcSystem.cs | 9 ++------- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/BatteryDischargerSystem.cs b/Content.Server/GameObjects/EntitySystems/BatteryDischargerSystem.cs index a00c76e668..f6d9ab7cc5 100644 --- a/Content.Server/GameObjects/EntitySystems/BatteryDischargerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BatteryDischargerSystem.cs @@ -11,13 +11,8 @@ namespace Content.Server.GameObjects.EntitySystems { public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery()) + foreach (var comp in ComponentManager.EntityQuery(false)) { - if (comp.Owner.Paused) - { - continue; - } - comp.Update(frameTime); } } diff --git a/Content.Server/GameObjects/EntitySystems/BatteryStorageSystem.cs b/Content.Server/GameObjects/EntitySystems/BatteryStorageSystem.cs index 16796b4169..8ace299025 100644 --- a/Content.Server/GameObjects/EntitySystems/BatteryStorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BatteryStorageSystem.cs @@ -11,13 +11,8 @@ namespace Content.Server.GameObjects.EntitySystems { public override void Update(float frameTime) { - foreach (var comp in ComponentManager.EntityQuery()) + foreach (var comp in ComponentManager.EntityQuery(false)) { - if (comp.Owner.Paused) - { - continue; - } - comp.Update(frameTime); } } diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index 5a78bbef97..6243f9794c 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -57,10 +57,10 @@ namespace Content.Server.GameObjects.EntitySystems public override void Update(float frameTime) { - foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery(false)) + foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery(false)) { var entity = moverComponent.Owner; - UpdateKinematics(entity.Transform, moverComponent, physics); + UpdateKinematics(entity.Transform, moverComponent, collidableComponent); } } diff --git a/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs index 68fe9cdfca..e4cfab08f5 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs @@ -13,14 +13,9 @@ namespace Content.Server.GameObjects.EntitySystems { public override void Update(float frameTime) { - var uniqueApcNets = new HashSet(); //could be improved by maintaining set instead of getting collection every frame - foreach (var apc in ComponentManager.EntityQuery()) + var uniqueApcNets = new HashSet(); //could be improved by maintaining set instead of getting collection every frame + foreach (var apc in ComponentManager.EntityQuery(false)) { - if (apc.Owner.Paused) - { - continue; - } - uniqueApcNets.Add(apc.Net); apc.Update(); }