AtmosphereSystem no longer creates a component manually. (#3839)
- Maps get SpaceGridAtmosphereComponent added automatically
This commit is contained in:
committed by
GitHub
parent
30d5b58319
commit
c17426dfa7
@@ -3,26 +3,20 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public static class AtmosHelpers
|
||||
{
|
||||
public static TileAtmosphere? GetTileAtmosphere(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
||||
public static TileAtmosphere? GetTileAtmosphere(this EntityCoordinates coordinates)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GetGridId(entityManager));
|
||||
|
||||
return gridAtmos.GetTile(coordinates);
|
||||
return EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates).GetTile(coordinates);
|
||||
}
|
||||
|
||||
public static GasMixture? GetTileAir(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
||||
{
|
||||
return coordinates.GetTileAtmosphere(entityManager)?.Air;
|
||||
return coordinates.GetTileAtmosphere()?.Air;
|
||||
}
|
||||
|
||||
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [NotNullWhen(true)] out TileAtmosphere? atmosphere)
|
||||
@@ -54,36 +48,6 @@ namespace Content.Server.Atmos
|
||||
return true;
|
||||
}
|
||||
|
||||
public static TileAtmosphere? GetTileAtmosphere(this Vector2i indices, GridId gridId)
|
||||
{
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(gridId);
|
||||
|
||||
return gridAtmos.GetTile(indices);
|
||||
}
|
||||
|
||||
public static GasMixture? GetTileAir(this Vector2i indices, GridId gridId)
|
||||
{
|
||||
return indices.GetTileAtmosphere(gridId)?.Air;
|
||||
}
|
||||
|
||||
public static bool TryGetTileAtmosphere(this Vector2i indices, GridId gridId,
|
||||
[NotNullWhen(true)] out TileAtmosphere? atmosphere)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(atmosphere = indices.GetTileAtmosphere(gridId), default);
|
||||
}
|
||||
|
||||
public static bool TryGetTileAir(this Vector2i indices, GridId gridId, [NotNullWhen(true)] out GasMixture? air)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(air = indices.GetTileAir(gridId), default);
|
||||
}
|
||||
|
||||
public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null)
|
||||
{
|
||||
return InvalidateTileAir(transform.Coordinates);
|
||||
}
|
||||
|
||||
public static bool InvalidateTileAir(this EntityCoordinates coordinates)
|
||||
{
|
||||
if (!coordinates.TryGetTileAtmosphere(out var tileAtmos))
|
||||
|
||||
Reference in New Issue
Block a user