Update ResearchSystem to not use IEntityQuery.
This commit is contained in:
@@ -1,23 +1,19 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Research;
|
using Content.Server.GameObjects.Components.Research;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
public class ResearchSystem : EntitySystem
|
public class ResearchSystem : EntitySystem
|
||||||
{
|
{
|
||||||
public const float ResearchConsoleUIUpdateTime = 30f;
|
private const float ResearchConsoleUIUpdateTime = 30f;
|
||||||
|
|
||||||
private float _timer = ResearchConsoleUIUpdateTime;
|
private float _timer = ResearchConsoleUIUpdateTime;
|
||||||
private readonly List<ResearchServerComponent> _servers = new();
|
private readonly List<ResearchServerComponent> _servers = new();
|
||||||
private readonly IEntityQuery ConsoleQuery;
|
|
||||||
public IReadOnlyList<ResearchServerComponent> Servers => _servers;
|
public IReadOnlyList<ResearchServerComponent> Servers => _servers;
|
||||||
|
|
||||||
public ResearchSystem()
|
|
||||||
{
|
|
||||||
ConsoleQuery = new TypeEntityQuery(typeof(ResearchConsoleComponent));
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool RegisterServer(ResearchServerComponent server)
|
public bool RegisterServer(ResearchServerComponent server)
|
||||||
{
|
{
|
||||||
if (_servers.Contains(server)) return false;
|
if (_servers.Contains(server)) return false;
|
||||||
@@ -75,9 +71,9 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
if (_timer >= ResearchConsoleUIUpdateTime)
|
if (_timer >= ResearchConsoleUIUpdateTime)
|
||||||
{
|
{
|
||||||
foreach (var console in EntityManager.GetEntities(ConsoleQuery))
|
foreach (var console in ComponentManager.EntityQuery<ResearchConsoleComponent>())
|
||||||
{
|
{
|
||||||
console.GetComponent<ResearchConsoleComponent>().UpdateUserInterface();
|
console.UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
_timer = 0f;
|
_timer = 0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user