Replace every usage of GridCoordinates with EntityCoordinates (#2021)
* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
@@ -2,31 +2,35 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public static class AtmosHelpers
|
||||
{
|
||||
public static TileAtmosphere? GetTileAtmosphere(this GridCoordinates coordinates)
|
||||
public static TileAtmosphere? GetTileAtmosphere(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
||||
{
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GridID);
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GetGridId(entityManager));
|
||||
|
||||
return gridAtmos?.GetTile(coordinates);
|
||||
}
|
||||
|
||||
public static GasMixture? GetTileAir(this GridCoordinates coordinates)
|
||||
public static GasMixture? GetTileAir(this EntityCoordinates coordinates)
|
||||
{
|
||||
return coordinates.GetTileAtmosphere()?.Air;
|
||||
}
|
||||
|
||||
public static bool TryGetTileAtmosphere(this GridCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
||||
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
|
||||
}
|
||||
|
||||
public static bool TryGetTileAir(this GridCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
|
||||
public static bool TryGetTileAir(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
|
||||
{
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
return !Equals(air = coordinates.GetTileAir()!, default);
|
||||
|
||||
Reference in New Issue
Block a user