Change Offset to take AtmosDirection instead of Direction (#4778)
This commit is contained in:
@@ -304,7 +304,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
var otherIndices = indices.Offset(direction.ToDirection());
|
||||
var otherIndices = indices.Offset(direction);
|
||||
var otherTile = GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, otherIndices);
|
||||
if (otherTile != null)
|
||||
AddActiveTile(gridAtmosphere, otherTile);
|
||||
@@ -1100,7 +1100,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
|
||||
var otherIndices = tileAtmosphere.GridIndices.Offset(direction.ToDirection());
|
||||
var otherIndices = tileAtmosphere.GridIndices.Offset(direction);
|
||||
|
||||
var adjacent = GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, otherIndices);
|
||||
tileAtmosphere.AdjacentTiles[direction.ToIndex()] = adjacent;
|
||||
@@ -1168,9 +1168,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="direction">Direction to be updated.</param>
|
||||
private void UpdateAdjacent(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, AtmosDirection direction)
|
||||
{
|
||||
tile.AdjacentTiles[direction.ToIndex()] = GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, tile.GridIndices.Offset(direction.ToDirection()));
|
||||
tile.AdjacentTiles[direction.ToIndex()] = GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, tile.GridIndices.Offset(direction));
|
||||
|
||||
if (!tile.BlockedAirflow.IsFlagSet(direction) && !IsTileAirBlocked(mapGrid, tile.GridIndices.Offset(direction.ToDirection()), direction.GetOpposite()))
|
||||
if (!tile.BlockedAirflow.IsFlagSet(direction) && !IsTileAirBlocked(mapGrid, tile.GridIndices.Offset(direction), direction.GetOpposite()))
|
||||
{
|
||||
tile.AdjacentBits |= direction;
|
||||
}
|
||||
|
||||
@@ -143,24 +143,24 @@ namespace Content.Shared.Atmos
|
||||
return (direction & other) == other;
|
||||
}
|
||||
|
||||
public static Vector2i CardinalToIntVec(this Direction dir)
|
||||
public static Vector2i CardinalToIntVec(this AtmosDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case Direction.North:
|
||||
case AtmosDirection.North:
|
||||
return new Vector2i(0, 1);
|
||||
case Direction.East:
|
||||
case AtmosDirection.East:
|
||||
return new Vector2i(1, 0);
|
||||
case Direction.South:
|
||||
case AtmosDirection.South:
|
||||
return new Vector2i(0, -1);
|
||||
case Direction.West:
|
||||
case AtmosDirection.West:
|
||||
return new Vector2i(-1, 0);
|
||||
default:
|
||||
throw new ArgumentException($"Direction dir {dir} is not a cardinal direction", nameof(dir));
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector2i Offset(this Vector2i pos, Direction dir)
|
||||
public static Vector2i Offset(this Vector2i pos, AtmosDirection dir)
|
||||
{
|
||||
return pos + dir.CardinalToIntVec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user