Replace MaybeNullWhen(false) with NotNullWhen(true)
This commit is contained in:
@@ -13,7 +13,7 @@ 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, IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
@@ -24,19 +24,19 @@ namespace Content.Server.Atmos
|
||||
|
||||
public static GasMixture? GetTileAir(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
||||
{
|
||||
return coordinates.GetTileAtmosphere(entityManager).Air;
|
||||
return coordinates.GetTileAtmosphere(entityManager)?.Air;
|
||||
}
|
||||
|
||||
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
||||
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [NotNullWhen(true)] out TileAtmosphere? atmosphere)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
|
||||
return !Equals(atmosphere = coordinates.GetTileAtmosphere(), default);
|
||||
}
|
||||
|
||||
public static bool TryGetTileAir(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air, IEntityManager? entityManager = null)
|
||||
public static bool TryGetTileAir(this EntityCoordinates coordinates, [NotNullWhen(true)] out GasMixture? air, IEntityManager? entityManager = null)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(air = coordinates.GetTileAir(entityManager)!, default);
|
||||
return !Equals(air = coordinates.GetTileAir(entityManager), default);
|
||||
}
|
||||
|
||||
public static bool IsTileAirProbablySafe(this EntityCoordinates coordinates)
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Atmos
|
||||
return true;
|
||||
}
|
||||
|
||||
public static TileAtmosphere GetTileAtmosphere(this Vector2i indices, GridId gridId)
|
||||
public static TileAtmosphere? GetTileAtmosphere(this Vector2i indices, GridId gridId)
|
||||
{
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(gridId);
|
||||
|
||||
@@ -69,28 +69,25 @@ namespace Content.Server.Atmos
|
||||
}
|
||||
|
||||
public static bool TryGetTileAtmosphere(this Vector2i indices, GridId gridId,
|
||||
[MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
||||
[NotNullWhen(true)] out TileAtmosphere? atmosphere)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(atmosphere = indices.GetTileAtmosphere(gridId)!, default);
|
||||
return !Equals(atmosphere = indices.GetTileAtmosphere(gridId), default);
|
||||
}
|
||||
|
||||
public static bool TryGetTileAir(this Vector2i indices, GridId gridId, [MaybeNullWhen(false)] out GasMixture air)
|
||||
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);
|
||||
return !Equals(air = indices.GetTileAir(gridId), default);
|
||||
}
|
||||
|
||||
public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null)
|
||||
{
|
||||
return InvalidateTileAir(transform.Coordinates, atmosSystem);
|
||||
return InvalidateTileAir(transform.Coordinates);
|
||||
}
|
||||
|
||||
public static bool InvalidateTileAir(this EntityCoordinates coordinates, AtmosphereSystem? atmosSystem = null, IEntityManager? entityManager = null)
|
||||
public static bool InvalidateTileAir(this EntityCoordinates coordinates)
|
||||
{
|
||||
atmosSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!coordinates.TryGetTileAtmosphere(out var tileAtmos))
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user