2020-08-13 13:51:57 +02:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
|
using Content.Server.GameObjects.EntitySystems;
|
2020-08-11 22:34:37 +02:00
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Atmos
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class AtmosHelpers
|
|
|
|
|
|
{
|
|
|
|
|
|
public static TileAtmosphere? GetTileAtmosphere(this GridCoordinates coordinates)
|
|
|
|
|
|
{
|
|
|
|
|
|
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GridID);
|
|
|
|
|
|
|
|
|
|
|
|
return gridAtmos?.GetTile(coordinates);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-13 13:51:57 +02:00
|
|
|
|
public static GasMixture? GetTileAir(this GridCoordinates coordinates)
|
|
|
|
|
|
{
|
|
|
|
|
|
return coordinates.GetTileAtmosphere()?.Air;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-18 13:32:18 +02:00
|
|
|
|
public static bool TryGetTileAtmosphere(this GridCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
2020-08-13 13:51:57 +02:00
|
|
|
|
{
|
2020-08-18 13:32:18 +02:00
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
|
|
|
|
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
|
2020-08-13 13:51:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-18 13:32:18 +02:00
|
|
|
|
public static bool TryGetTileAir(this GridCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
|
2020-08-13 13:51:57 +02:00
|
|
|
|
{
|
2020-08-18 13:32:18 +02:00
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
|
|
|
|
return !Equals(air = coordinates.GetTileAir()!, default);
|
2020-08-13 13:51:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-11 22:34:37 +02:00
|
|
|
|
public static TileAtmosphere? GetTileAtmosphere(this MapIndices indices, GridId gridId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(gridId);
|
|
|
|
|
|
|
|
|
|
|
|
return gridAtmos?.GetTile(indices);
|
|
|
|
|
|
}
|
2020-08-13 13:51:57 +02:00
|
|
|
|
|
|
|
|
|
|
public static GasMixture? GetTileAir(this MapIndices indices, GridId gridId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return indices.GetTileAtmosphere(gridId)?.Air;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool TryGetTileAtmosphere(this MapIndices indices, GridId gridId,
|
2020-08-18 13:32:18 +02:00
|
|
|
|
[MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
2020-08-13 13:51:57 +02:00
|
|
|
|
{
|
2020-08-18 13:32:18 +02:00
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
|
|
|
|
return !Equals(atmosphere = indices.GetTileAtmosphere(gridId)!, default);
|
2020-08-13 13:51:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-18 13:32:18 +02:00
|
|
|
|
public static bool TryGetTileAir(this MapIndices indices, GridId gridId, [MaybeNullWhen(false)] out GasMixture air)
|
2020-08-13 13:51:57 +02:00
|
|
|
|
{
|
2020-08-18 13:32:18 +02:00
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
|
|
|
|
return !Equals(air = indices.GetTileAir(gridId)!, default);
|
2020-08-13 13:51:57 +02:00
|
|
|
|
}
|
2020-08-11 22:34:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|