Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/AtmosExposedSystem.cs
Vera Aguilera Puerto c17426dfa7 AtmosphereSystem no longer creates a component manually. (#3839)
- Maps get SpaceGridAtmosphereComponent added automatically
2021-04-13 13:17:10 +02:00

33 lines
1002 B
C#

using Content.Server.Atmos;
using Content.Server.GameObjects.Components.Atmos;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
public class AtmosExposedSystem
: EntitySystem
{
private const float UpdateDelay = 1f;
private float _lastUpdate;
public override void Update(float frameTime)
{
_lastUpdate += frameTime;
if (_lastUpdate < UpdateDelay) return;
// creadth: everything exposable by atmos should be updated as well
foreach (var atmosExposedComponent in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>(true))
{
var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere();
if (tile == null) continue;
atmosExposedComponent.Update(tile, _lastUpdate);
}
_lastUpdate = 0;
}
}
}