Add more atmos helpers (#1661)
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
#nullable enable
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos
|
namespace Content.Server.Atmos
|
||||||
{
|
{
|
||||||
public static class AtmosHelpers
|
public static class AtmosHelpers
|
||||||
@@ -15,11 +15,42 @@ namespace Content.Server.Atmos
|
|||||||
return gridAtmos?.GetTile(coordinates);
|
return gridAtmos?.GetTile(coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GasMixture? GetTileAir(this GridCoordinates coordinates)
|
||||||
|
{
|
||||||
|
return coordinates.GetTileAtmosphere()?.Air;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetTileAtmosphere(this GridCoordinates coordinates, [NotNullWhen(true)] out TileAtmosphere atmosphere)
|
||||||
|
{
|
||||||
|
return (atmosphere = coordinates.GetTileAtmosphere()!) != default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetTileAir(this GridCoordinates coordinates, [NotNullWhen(true)] out GasMixture air)
|
||||||
|
{
|
||||||
|
return !(air = coordinates.GetTileAir()!).Equals(default);
|
||||||
|
}
|
||||||
|
|
||||||
public static TileAtmosphere? GetTileAtmosphere(this MapIndices indices, GridId gridId)
|
public static TileAtmosphere? GetTileAtmosphere(this MapIndices indices, GridId gridId)
|
||||||
{
|
{
|
||||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(gridId);
|
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(gridId);
|
||||||
|
|
||||||
return gridAtmos?.GetTile(indices);
|
return gridAtmos?.GetTile(indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GasMixture? GetTileAir(this MapIndices indices, GridId gridId)
|
||||||
|
{
|
||||||
|
return indices.GetTileAtmosphere(gridId)?.Air;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetTileAtmosphere(this MapIndices indices, GridId gridId,
|
||||||
|
[NotNullWhen(true)] out TileAtmosphere atmosphere)
|
||||||
|
{
|
||||||
|
return (atmosphere = indices.GetTileAtmosphere(gridId)!) != default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetTileAir(this MapIndices indices, GridId gridId, [NotNullWhen(true)] out GasMixture air)
|
||||||
|
{
|
||||||
|
return !(air = indices.GetTileAir(gridId)!).Equals(default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user