Slight AtmosphereSystem cleanup.

- AtmosExposed query now queries transform as well instead of getting it twice.
- Use Proxy methods instead.
This commit is contained in:
Vera Aguilera Puerto
2021-12-16 12:10:51 +01:00
parent 7e49b22a74
commit 0517e12efd
4 changed files with 44 additions and 43 deletions

View File

@@ -71,18 +71,18 @@ namespace Content.Server.Atmos.EntitySystems
_exposedTimer += frameTime;
if (_exposedTimer >= ExposedUpdateDelay)
{
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
{
var tile = GetTileMixture(EntityManager.GetComponent<TransformComponent>(exposed.Owner).Coordinates);
if (tile == null) continue;
var updateEvent = new AtmosExposedUpdateEvent(EntityManager.GetComponent<TransformComponent>(exposed.Owner).Coordinates, tile);
RaiseLocalEvent(exposed.Owner, ref updateEvent);
}
if (_exposedTimer < ExposedUpdateDelay)
return;
_exposedTimer -= ExposedUpdateDelay;
foreach (var (exposed, transform) in EntityManager.EntityQuery<AtmosExposedComponent, TransformComponent>())
{
var tile = GetTileMixture(transform.Coordinates);
if (tile == null) continue;
var updateEvent = new AtmosExposedUpdateEvent(transform.Coordinates, tile);
RaiseLocalEvent(exposed.Owner, ref updateEvent);
}
_exposedTimer -= ExposedUpdateDelay;
}
}
}