2020-10-28 19:19:47 +01:00
|
|
|
using Content.Server.GameObjects.Components.Singularity;
|
2020-12-08 11:56:10 +01:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
|
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
[UsedImplicitly]
|
2020-10-28 19:19:47 +01:00
|
|
|
public class SingularitySystem : EntitySystem
|
|
|
|
|
{
|
2021-03-09 04:33:41 -06:00
|
|
|
private float _updateInterval = 1.0f;
|
2021-03-08 04:09:59 +11:00
|
|
|
private float _accumulator;
|
2020-12-08 11:56:10 +01:00
|
|
|
|
2020-10-28 19:19:47 +01:00
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
base.Update(frameTime);
|
2021-03-08 04:09:59 +11:00
|
|
|
_accumulator += frameTime;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2021-03-09 04:33:41 -06:00
|
|
|
while (_accumulator > _updateInterval)
|
2020-10-28 19:19:47 +01:00
|
|
|
{
|
2021-03-09 04:33:41 -06:00
|
|
|
_accumulator -= _updateInterval;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2021-03-09 04:33:41 -06:00
|
|
|
foreach (var singularity in ComponentManager.EntityQuery<ServerSingularityComponent>())
|
2020-10-28 19:19:47 +01:00
|
|
|
{
|
2021-03-08 04:09:59 +11:00
|
|
|
singularity.Update(1);
|
2020-10-28 19:19:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-03-09 04:33:41 -06:00
|
|
|
|
2020-10-28 19:19:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|