Adds Invalidate method to TileAtmosphere, clean up a bunch of tile invalidations

This commit is contained in:
Vera Aguilera Puerto
2020-12-08 17:36:59 +01:00
parent 656eb7dc2e
commit 2b6964746c
10 changed files with 19 additions and 20 deletions

View File

@@ -65,15 +65,7 @@ namespace Content.Server.Atmos
public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null)
{
atmosSystem ??= EntitySystem.Get<AtmosphereSystem>();
if (!transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos))
{
return false;
}
atmosSystem.GetGridAtmosphere(transform.GridID).Invalidate(tileAtmos.GridIndices);
return true;
return InvalidateTileAir(transform.Coordinates, atmosSystem);
}
public static bool InvalidateTileAir(this EntityCoordinates coordinates, AtmosphereSystem? atmosSystem = null, IEntityManager? entityManager = null)
@@ -86,8 +78,7 @@ namespace Content.Server.Atmos
return false;
}
var gridId = coordinates.GetGridId(entityManager);
atmosSystem.GetGridAtmosphere(gridId).Invalidate(tileAtmos.GridIndices);
tileAtmos.Invalidate();
return true;
}
}