Refactor pauses (#2215)

* Refactor pauses

* The last of the physics

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-10-26 22:07:11 +11:00
committed by GitHub
parent 47c88c294b
commit 8a2e0ed142
4 changed files with 6 additions and 21 deletions

View File

@@ -11,13 +11,8 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
foreach (var comp in ComponentManager.EntityQuery<BatteryDischargerComponent>()) foreach (var comp in ComponentManager.EntityQuery<BatteryDischargerComponent>(false))
{ {
if (comp.Owner.Paused)
{
continue;
}
comp.Update(frameTime); comp.Update(frameTime);
} }
} }

View File

@@ -11,13 +11,8 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
foreach (var comp in ComponentManager.EntityQuery<BatteryStorageComponent>()) foreach (var comp in ComponentManager.EntityQuery<BatteryStorageComponent>(false))
{ {
if (comp.Owner.Paused)
{
continue;
}
comp.Update(frameTime); comp.Update(frameTime);
} }
} }

View File

@@ -57,10 +57,10 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>(false)) foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>(false))
{ {
var entity = moverComponent.Owner; var entity = moverComponent.Owner;
UpdateKinematics(entity.Transform, moverComponent, physics); UpdateKinematics(entity.Transform, moverComponent, collidableComponent);
} }
} }

View File

@@ -13,14 +13,9 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
var uniqueApcNets = new HashSet<IApcNet>(); //could be improved by maintaining set instead of getting collection every frame var uniqueApcNets = new HashSet<IApcNet>(); //could be improved by maintaining set instead of getting collection every frame
foreach (var apc in ComponentManager.EntityQuery<ApcComponent>()) foreach (var apc in ComponentManager.EntityQuery<ApcComponent>(false))
{ {
if (apc.Owner.Paused)
{
continue;
}
uniqueApcNets.Add(apc.Net); uniqueApcNets.Add(apc.Net);
apc.Update(); apc.Update();
} }