2020-09-09 18:03:27 +03:00
|
|
|
|
using Content.Server.Atmos;
|
|
|
|
|
|
using Content.Server.GameObjects.Components.Atmos;
|
|
|
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
|
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
|
public class AtmosExposedSystem
|
|
|
|
|
|
: EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2020-09-22 15:40:04 +02:00
|
|
|
|
private const float UpdateDelay = 1f;
|
2020-09-09 18:03:27 +03:00
|
|
|
|
private float _lastUpdate;
|
2020-09-22 15:40:04 +02:00
|
|
|
|
|
2020-09-09 18:03:27 +03:00
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
_lastUpdate += frameTime;
|
|
|
|
|
|
if (_lastUpdate < UpdateDelay) return;
|
2020-09-22 15:40:04 +02:00
|
|
|
|
|
2020-09-13 14:23:52 +02:00
|
|
|
|
// creadth: everything exposable by atmos should be updated as well
|
2021-02-04 00:20:48 +11:00
|
|
|
|
foreach (var atmosExposedComponent in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>(true))
|
2020-09-09 18:03:27 +03:00
|
|
|
|
{
|
2021-04-13 13:17:10 +02:00
|
|
|
|
var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere();
|
2020-09-09 18:03:27 +03:00
|
|
|
|
if (tile == null) continue;
|
|
|
|
|
|
atmosExposedComponent.Update(tile, _lastUpdate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_lastUpdate = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|