2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Solar.Components;
|
2020-06-02 12:32:18 +01:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-06-02 12:32:18 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Solar.EntitySystems
|
2020-06-02 12:32:18 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Responsible for updating solar control consoles.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[UsedImplicitly]
|
2020-08-13 22:17:12 +10:00
|
|
|
internal sealed class PowerSolarControlConsoleSystem : EntitySystem
|
2020-06-02 12:32:18 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Timer used to avoid updating the UI state every frame (which would be overkill)
|
|
|
|
|
/// </summary>
|
2020-08-13 22:17:12 +10:00
|
|
|
private float _updateTimer;
|
2020-06-02 12:32:18 +01:00
|
|
|
|
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
_updateTimer += frameTime;
|
|
|
|
|
if (_updateTimer >= 1)
|
2020-06-02 12:32:18 +01:00
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
_updateTimer -= 1;
|
2021-02-04 00:20:48 +11:00
|
|
|
foreach (var component in ComponentManager.EntityQuery<SolarControlConsoleComponent>(true))
|
2020-06-02 12:32:18 +01:00
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
component.UpdateUIState();
|
2020-06-02 12:32:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|