Revert "Welders now use EntityQuery to update instead of subscriptions."

This reverts commit a815b50f6d and fixes the issue properly.
This commit is contained in:
Víctor Aguilera Puerto
2020-08-15 00:12:30 +02:00
parent a815b50f6d
commit b2709733a5
2 changed files with 23 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Interactable;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
@@ -11,12 +10,23 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary>
public class WelderSystem : EntitySystem
{
private readonly HashSet<WelderComponent> _activeWelders = new HashSet<WelderComponent>();
public bool Subscribe(WelderComponent welder)
{
return _activeWelders.Add(welder);
}
public bool Unsubscribe(WelderComponent welder)
{
return _activeWelders.Remove(welder);
}
public override void Update(float frameTime)
{
foreach (var welder in EntityManager.ComponentManager.EntityQuery<WelderComponent>())
foreach (var tool in _activeWelders.ToArray())
{
if(welder.WelderLit && !welder.Owner.Deleted)
welder.OnUpdate(frameTime);
tool.OnUpdate(frameTime);
}
}
}