diff --git a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs
index 7515d40d51..2513b6f062 100644
--- a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs
+++ b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs
@@ -35,7 +35,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
internal ISpriteComponent Sprite { get; private set; }
internal SnapGridComponent SnapGrid { get; private set; }
- private (GridId, MapIndices) _lastPosition;
+ private (GridId, Vector2i) _lastPosition;
///
/// We will smooth with other objects with the same key.
diff --git a/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs
index b6b80b22b7..b00b98485f 100644
--- a/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs
+++ b/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs
@@ -69,7 +69,7 @@ namespace Content.Client.GameObjects.EntitySystems
return _tileData.ContainsKey(gridId);
}
- public AtmosDebugOverlayData? GetData(GridId gridIndex, MapIndices indices)
+ public AtmosDebugOverlayData? GetData(GridId gridIndex, Vector2i indices)
{
if (!_tileData.TryGetValue(gridIndex, out var srcMsg))
return null;
diff --git a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs b/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
index a2a7bf5079..e235c2f06e 100644
--- a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
+++ b/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
@@ -41,8 +41,8 @@ namespace Content.Client.GameObjects.EntitySystems
private readonly int[] _fireFrameCounter = new int[FireStates];
private readonly Texture[][] _fireFrames = new Texture[FireStates][];
- private Dictionary> _tileData =
- new Dictionary>();
+ private Dictionary> _tileData =
+ new Dictionary>();
private AtmosphereSystem _atmosphereSystem = default!;
@@ -107,11 +107,11 @@ namespace Content.Client.GameObjects.EntitySystems
}
// Slightly different to the server-side system version
- private GasOverlayChunk GetOrCreateChunk(GridId gridId, MapIndices indices)
+ private GasOverlayChunk GetOrCreateChunk(GridId gridId, Vector2i indices)
{
if (!_tileData.TryGetValue(gridId, out var chunks))
{
- chunks = new Dictionary();
+ chunks = new Dictionary();
_tileData[gridId] = chunks;
}
@@ -148,7 +148,7 @@ namespace Content.Client.GameObjects.EntitySystems
return _tileData.ContainsKey(gridId);
}
- public (Texture, Color color)[] GetOverlays(GridId gridIndex, MapIndices indices)
+ public (Texture, Color color)[] GetOverlays(GridId gridIndex, Vector2i indices)
{
if (!_tileData.TryGetValue(gridIndex, out var chunks))
return Array.Empty<(Texture, Color)>();
diff --git a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs
index 330abf38d8..12018fa85e 100644
--- a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs
+++ b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs
@@ -82,16 +82,16 @@ namespace Content.Client.GameObjects.EntitySystems
{
var pos = ev.LastPosition.Value.pos;
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(1, 0), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(-1, 0), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(0, 1), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(0, -1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(1, 0), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(-1, 0), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(0, 1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(0, -1), ev.Offset));
if (ev.Mode == IconSmoothingMode.Corners)
{
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(1, 1), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(-1, -1), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(-1, 1), ev.Offset));
- AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(1, -1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(1, 1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(-1, -1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(-1, 1), ev.Offset));
+ AddValidEntities(grid.GetSnapGridCell(pos + new Vector2i(1, -1), ev.Offset));
}
}
}
@@ -135,7 +135,7 @@ namespace Content.Client.GameObjects.EntitySystems
///
public sealed class IconSmoothDirtyEvent : EntitySystemMessage
{
- public IconSmoothDirtyEvent(IEntity sender, (GridId grid, MapIndices pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode)
+ public IconSmoothDirtyEvent(IEntity sender, (GridId grid, Vector2i pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode)
{
LastPosition = lastPosition;
Offset = offset;
@@ -143,7 +143,7 @@ namespace Content.Client.GameObjects.EntitySystems
Sender = sender;
}
- public (GridId grid, MapIndices pos)? LastPosition { get; }
+ public (GridId grid, Vector2i pos)? LastPosition { get; }
public SnapGridOffset Offset { get; }
public IconSmoothingMode Mode { get; }
public IEntity Sender { get; }
diff --git a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs
index 95e0cfe963..5ac823dbce 100644
--- a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs
+++ b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs
@@ -6,6 +6,7 @@ using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.EntitySystems
@@ -80,7 +81,7 @@ namespace Content.Client.GameObjects.EntitySystems
}
}
- private void UpdateTile(IMapGrid grid, MapIndices position)
+ private void UpdateTile(IMapGrid grid, Vector2i position)
{
var tile = grid.GetTileRef(position);
var tileDef = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
diff --git a/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs b/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs
index 5a9e4fe6f2..06de0ea550 100644
--- a/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs
+++ b/Content.IntegrationTests/Tests/Atmos/AtmosHelpersTest.cs
@@ -3,6 +3,7 @@ using Content.Server.Atmos;
using NUnit.Framework;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.IntegrationTests.Tests.Atmos
{
@@ -91,7 +92,7 @@ namespace Content.IntegrationTests.Tests.Atmos
}
[Test]
- public async Task GetTileAtmosphereMapIndicesNotNullTest()
+ public async Task GetTileAtmosphereVector2iNotNullTest()
{
var server = StartServerDummyTicker();
@@ -99,7 +100,7 @@ namespace Content.IntegrationTests.Tests.Atmos
{
Assert.DoesNotThrow(() =>
{
- var atmosphere = default(MapIndices).GetTileAtmosphere(default);
+ var atmosphere = default(Vector2i).GetTileAtmosphere(default);
Assert.NotNull(atmosphere);
});
@@ -109,7 +110,7 @@ namespace Content.IntegrationTests.Tests.Atmos
}
[Test]
- public async Task GetTileAirMapIndicesNotNullTest()
+ public async Task GetTileAirVector2iNotNullTest()
{
var server = StartServerDummyTicker();
@@ -117,7 +118,7 @@ namespace Content.IntegrationTests.Tests.Atmos
{
Assert.DoesNotThrow(() =>
{
- var air = default(MapIndices).GetTileAir(default);
+ var air = default(Vector2i).GetTileAir(default);
Assert.NotNull(air);
});
@@ -127,7 +128,7 @@ namespace Content.IntegrationTests.Tests.Atmos
}
[Test]
- public async Task TryGetTileAtmosphereMapIndicesNotNullTest()
+ public async Task TryGetTileAtmosphereVector2iNotNullTest()
{
var server = StartServerDummyTicker();
@@ -135,7 +136,7 @@ namespace Content.IntegrationTests.Tests.Atmos
{
Assert.DoesNotThrow(() =>
{
- var hasAtmosphere = default(MapIndices).TryGetTileAtmosphere(default, out var atmosphere);
+ var hasAtmosphere = default(Vector2i).TryGetTileAtmosphere(default, out var atmosphere);
Assert.True(hasAtmosphere);
Assert.NotNull(atmosphere);
@@ -146,7 +147,7 @@ namespace Content.IntegrationTests.Tests.Atmos
}
[Test]
- public async Task TryGetTileAirMapIndicesNotNullTest()
+ public async Task TryGetTileAirVector2iNotNullTest()
{
var server = StartServerDummyTicker();
@@ -154,7 +155,7 @@ namespace Content.IntegrationTests.Tests.Atmos
{
Assert.DoesNotThrow(() =>
{
- var hasAir = default(MapIndices).TryGetTileAir(default, out var air);
+ var hasAir = default(Vector2i).TryGetTileAir(default, out var air);
Assert.True(hasAir);
Assert.NotNull(air);
diff --git a/Content.IntegrationTests/Tests/GridTileLookupTest.cs b/Content.IntegrationTests/Tests/GridTileLookupTest.cs
index a854626a0f..1538b6341f 100644
--- a/Content.IntegrationTests/Tests/GridTileLookupTest.cs
+++ b/Content.IntegrationTests/Tests/GridTileLookupTest.cs
@@ -32,15 +32,15 @@ namespace Content.IntegrationTests.Tests
var tileDefinition = tileDefinitionManager["underplating"];
var underplating = new Tile(tileDefinition.TileId);
- gridOne.SetTile(new MapIndices(0, 0), underplating);
- gridOne.SetTile(new MapIndices(-1, -1), underplating);
+ gridOne.SetTile(new Vector2i(0, 0), underplating);
+ gridOne.SetTile(new Vector2i(-1, -1), underplating);
- entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(0, 0)).ToList();
+ entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(0, 0)).ToList();
Assert.That(entities.Count, Is.EqualTo(0));
// Space entity, check that nothing intersects it and that also it doesn't throw.
entityManager.SpawnEntity("HumanMob_Content", new MapCoordinates(Vector2.One * 1000, mapOne));
- entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(1000, 1000)).ToList();
+ entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(1000, 1000)).ToList();
Assert.That(entities.Count, Is.EqualTo(0));
var entityOne = entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
@@ -54,10 +54,10 @@ namespace Content.IntegrationTests.Tests
Assert.That(entities.Count, Is.EqualTo(3));
// Both dummies should be in each corner of the 0,0 tile but only one dummy intersects -1,-1
- entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(-1, -1)).ToList();
+ entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(-1, -1)).ToList();
Assert.That(entities.Count, Is.EqualTo(1));
- entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(0, 0)).ToList();
+ entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(0, 0)).ToList();
Assert.That(entities.Count, Is.EqualTo(2));
});
diff --git a/Content.IntegrationTests/Tests/Pathfinding/PathfindingChunkTest.cs b/Content.IntegrationTests/Tests/Pathfinding/PathfindingChunkTest.cs
index 8c6d42a5c6..cc5ee8a17d 100644
--- a/Content.IntegrationTests/Tests/Pathfinding/PathfindingChunkTest.cs
+++ b/Content.IntegrationTests/Tests/Pathfinding/PathfindingChunkTest.cs
@@ -18,7 +18,7 @@ namespace Content.IntegrationTests.Tests.Pathfinding
public async Task Test()
{
var server = StartServerDummyTicker();
-
+
server.Assert(() =>
{
var pathfindingSystem = EntitySystem.Get();
@@ -28,32 +28,32 @@ namespace Content.IntegrationTests.Tests.Pathfinding
var mapId = mapMan.CreateMap(new MapId(1));
var gridId = new GridId(2);
mapMan.CreateGrid(mapId, gridId);
- var chunkTile = mapMan.GetGrid(gridId).GetTileRef(new MapIndices(0, 0));
+ var chunkTile = mapMan.GetGrid(gridId).GetTileRef(new Vector2i(0, 0));
var chunk = pathfindingSystem.GetChunk(chunkTile);
Assert.That(chunk.Nodes.Length == PathfindingChunk.ChunkSize * PathfindingChunk.ChunkSize);
-
+
// Neighbors
var chunkNeighbors = chunk.GetNeighbors().ToList();
Assert.That(chunkNeighbors.Count == 0);
- var neighborChunkTile = mapMan.GetGrid(gridId).GetTileRef(new MapIndices(PathfindingChunk.ChunkSize, PathfindingChunk.ChunkSize));
+ var neighborChunkTile = mapMan.GetGrid(gridId).GetTileRef(new Vector2i(PathfindingChunk.ChunkSize, PathfindingChunk.ChunkSize));
var neighborChunk = pathfindingSystem.GetChunk(neighborChunkTile);
chunkNeighbors = chunk.GetNeighbors().ToList();
Assert.That(chunkNeighbors.Count == 1);
-
+
// Directions
Assert.That(PathfindingHelpers.RelativeDirection(neighborChunk, chunk) == Direction.NorthEast);
Assert.That(PathfindingHelpers.RelativeDirection(chunk.Nodes[0, 1], chunk.Nodes[0, 0]) == Direction.North);
-
+
// Nodes
var node = chunk.Nodes[1, 1];
var nodeNeighbors = node.GetNeighbors().ToList();
Assert.That(nodeNeighbors.Count == 8);
-
+
// Bottom-left corner with no chunk neighbor
node = chunk.Nodes[0, 0];
nodeNeighbors = node.GetNeighbors().ToList();
Assert.That(nodeNeighbors.Count == 3);
-
+
// Given we have 1 NE neighbor then NE corner should have 4 neighbors due to the 1 extra from the neighbor chunk
node = chunk.Nodes[PathfindingChunk.ChunkSize - 1, PathfindingChunk.ChunkSize - 1];
nodeNeighbors = node.GetNeighbors().ToList();
@@ -62,4 +62,4 @@ namespace Content.IntegrationTests.Tests.Pathfinding
await server.WaitIdleAsync();
}
}
-}
\ No newline at end of file
+}
diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs
index e6c685285c..d0fac8904a 100644
--- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs
+++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs
@@ -37,13 +37,13 @@ namespace Content.IntegrationTests.Tests
var mapGrid = mapManager.CreateGrid(mapId);
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
mapGridEnt.Transform.WorldPosition = new Vector2(10, 10);
- mapGrid.SetTile(new MapIndices(0,0), new Tile(1, 512));
+ mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512));
}
{
var mapGrid = mapManager.CreateGrid(mapId);
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
mapGridEnt.Transform.WorldPosition = new Vector2(-8, -8);
- mapGrid.SetTile(new MapIndices(0, 0), new Tile(2, 511));
+ mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511));
}
mapLoader.SaveMap(mapId, mapPath);
@@ -63,14 +63,14 @@ namespace Content.IntegrationTests.Tests
Assert.Fail();
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(10, 10)));
- Assert.That(mapGrid.GetTileRef(new MapIndices(0, 0)).Tile, Is.EqualTo(new Tile(1, 512)));
+ Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(1, 512)));
}
{
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid))
Assert.Fail();
Assert.That(mapGrid.WorldPosition, Is.EqualTo(new Vector2(-8, -8)));
- Assert.That(mapGrid.GetTileRef(new MapIndices(0, 0)).Tile, Is.EqualTo(new Tile(2, 511)));
+ Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(2, 511)));
}
}
diff --git a/Content.Server/Atmos/AtmosCommands.cs b/Content.Server/Atmos/AtmosCommands.cs
index 1b69ba5c80..3785e7fe85 100644
--- a/Content.Server/Atmos/AtmosCommands.cs
+++ b/Content.Server/Atmos/AtmosCommands.cs
@@ -11,6 +11,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.Server.Atmos
{
@@ -176,7 +177,7 @@ namespace Content.Server.Atmos
}
var gam = grid.GetComponent();
- var indices = new MapIndices(x, y);
+ var indices = new Vector2i(x, y);
var tile = gam.GetTile(indices);
if (tile == null)
@@ -300,7 +301,7 @@ namespace Content.Server.Atmos
}
var gam = grid.GetComponent();
- var indices = new MapIndices(x, y);
+ var indices = new Vector2i(x, y);
var tile = gam.GetTile(indices);
if (tile == null)
@@ -368,7 +369,7 @@ namespace Content.Server.Atmos
}
var gam = grid.GetComponent();
- var indices = new MapIndices(x, y);
+ var indices = new Vector2i(x, y);
var tile = gam.GetTile(indices);
if (tile == null)
diff --git a/Content.Server/Atmos/AtmosHelpers.cs b/Content.Server/Atmos/AtmosHelpers.cs
index e7e8371804..9f01f8090a 100644
--- a/Content.Server/Atmos/AtmosHelpers.cs
+++ b/Content.Server/Atmos/AtmosHelpers.cs
@@ -5,6 +5,7 @@ using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.Server.Atmos
{
@@ -36,26 +37,26 @@ namespace Content.Server.Atmos
return !Equals(air = coordinates.GetTileAir(entityManager)!, default);
}
- public static TileAtmosphere? GetTileAtmosphere(this MapIndices indices, GridId gridId)
+ public static TileAtmosphere? GetTileAtmosphere(this Vector2i indices, GridId gridId)
{
var gridAtmos = EntitySystem.Get().GetGridAtmosphere(gridId);
return gridAtmos?.GetTile(indices);
}
- public static GasMixture? GetTileAir(this MapIndices indices, GridId gridId)
+ public static GasMixture? GetTileAir(this Vector2i indices, GridId gridId)
{
return indices.GetTileAtmosphere(gridId)?.Air;
}
- public static bool TryGetTileAtmosphere(this MapIndices indices, GridId gridId,
+ public static bool TryGetTileAtmosphere(this Vector2i indices, GridId gridId,
[MaybeNullWhen(false)] out TileAtmosphere atmosphere)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
return !Equals(atmosphere = indices.GetTileAtmosphere(gridId)!, default);
}
- public static bool TryGetTileAir(this MapIndices indices, GridId gridId, [MaybeNullWhen(false)] out GasMixture air)
+ public static bool TryGetTileAir(this Vector2i indices, GridId gridId, [MaybeNullWhen(false)] out GasMixture air)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
return !Equals(air = indices.GetTileAir(gridId)!, default);
diff --git a/Content.Server/Atmos/EntityNetworkUtils.cs b/Content.Server/Atmos/EntityNetworkUtils.cs
index f5d09e947b..1a00fe83b9 100644
--- a/Content.Server/Atmos/EntityNetworkUtils.cs
+++ b/Content.Server/Atmos/EntityNetworkUtils.cs
@@ -23,9 +23,9 @@ namespace Content.Server.Atmos
}
}
- public static MapIndices Offset(this MapIndices pos, Direction dir)
+ public static Vector2i Offset(this Vector2i pos, Direction dir)
{
- return pos + (MapIndices) dir.CardinalToIntVec();
+ return pos + (Vector2i) dir.CardinalToIntVec();
}
}
}
diff --git a/Content.Server/Atmos/IGridAtmosphereComponent.cs b/Content.Server/Atmos/IGridAtmosphereComponent.cs
index 0d7a827bf9..81f4def85b 100644
--- a/Content.Server/Atmos/IGridAtmosphereComponent.cs
+++ b/Content.Server/Atmos/IGridAtmosphereComponent.cs
@@ -25,31 +25,31 @@ namespace Content.Server.Atmos
/// Attemps to pry a tile.
///
///
- void PryTile(MapIndices indices);
+ void PryTile(Vector2i indices);
///
/// Burns a tile.
///
///
- void BurnTile(MapIndices gridIndices);
+ void BurnTile(Vector2i gridIndices);
///
/// Invalidates a coordinate to be revalidated again.
/// Use this after changing a tile's gas contents, or when the tile becomes space, etc.
///
///
- void Invalidate(MapIndices indices);
+ void Invalidate(Vector2i indices);
///
/// Attempts to fix a sudden vacuum by creating gas.
///
- void FixVacuum(MapIndices indices);
+ void FixVacuum(Vector2i indices);
///
/// Revalidates indices immediately.
///
///
- void UpdateAdjacentBits(MapIndices indices);
+ void UpdateAdjacentBits(Vector2i indices);
///
/// Adds an active tile so it becomes processed every update until it becomes inactive.
@@ -120,7 +120,7 @@ namespace Content.Server.Atmos
///
///
///
- TileAtmosphere GetTile(MapIndices indices, bool createSpace = true);
+ TileAtmosphere GetTile(Vector2i indices, bool createSpace = true);
///
/// Returns a tile.
@@ -138,14 +138,14 @@ namespace Content.Server.Atmos
///
///
///
- bool IsAirBlocked(MapIndices indices, AtmosDirection direction);
+ bool IsAirBlocked(Vector2i indices, AtmosDirection direction);
///
/// Returns if the tile in question is space.
///
///
///
- bool IsSpace(MapIndices indices);
+ bool IsSpace(Vector2i indices);
///
/// Returns the volume in liters for a number of cells/tiles.
@@ -157,7 +157,7 @@ namespace Content.Server.Atmos
///
/// Returns a dictionary of adjacent TileAtmospheres.
///
- Dictionary GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false);
+ Dictionary GetAdjacentTiles(Vector2i indices, bool includeAirBlocked = false);
void Update(float frameTime);
diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs
index 0ed83e90be..2263164075 100644
--- a/Content.Server/Atmos/TileAtmosphere.cs
+++ b/Content.Server/Atmos/TileAtmosphere.cs
@@ -106,7 +106,7 @@ namespace Content.Server.Atmos
public TileRef? Tile => GridIndices.GetTileRef(GridIndex);
[ViewVariables]
- public MapIndices GridIndices { get; }
+ public Vector2i GridIndices { get; }
[ViewVariables]
public ExcitedGroup ExcitedGroup { get; set; }
@@ -122,7 +122,7 @@ namespace Content.Server.Atmos
[ViewVariables]
public bool BlocksAllAir => BlockedAirflow == AtmosDirection.All;
- public TileAtmosphere(GridAtmosphereComponent atmosphereComponent, GridId gridIndex, MapIndices gridIndices, GasMixture mixture = null, bool immutable = false)
+ public TileAtmosphere(GridAtmosphereComponent atmosphereComponent, GridId gridIndex, Vector2i gridIndices, GasMixture mixture = null, bool immutable = false)
{
IoCManager.InjectDependencies(this);
_gridAtmosphereComponent = atmosphereComponent;
@@ -197,7 +197,7 @@ namespace Content.Server.Atmos
{
if(_soundCooldown == 0)
EntitySystem.Get().PlayAtCoords("/Audio/Effects/space_wind.ogg",
- GridIndices.ToEntityCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100)));
+ GridIndices.ToEntityCoordinates(GridIndex, _mapManager), AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100)));
}
foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices))
@@ -212,7 +212,7 @@ namespace Content.Server.Atmos
var pressureMovements = physics.EnsureController();
if (pressure.LastHighPressureMovementAirCycle < _gridAtmosphereComponent.UpdateCounter)
{
- pressureMovements.ExperiencePressureDifference(_gridAtmosphereComponent.UpdateCounter, PressureDifference, _pressureDirection, 0, PressureSpecificTarget?.GridIndices.ToEntityCoordinates(_mapManager, GridIndex) ?? EntityCoordinates.Invalid);
+ pressureMovements.ExperiencePressureDifference(_gridAtmosphereComponent.UpdateCounter, PressureDifference, _pressureDirection, 0, PressureSpecificTarget?.GridIndices.ToEntityCoordinates(GridIndex, _mapManager) ?? EntityCoordinates.Invalid);
}
}
diff --git a/Content.Server/Construction/Conditions/ComponentInTile.cs b/Content.Server/Construction/Conditions/ComponentInTile.cs
index 2f2c717f04..0a456462a4 100644
--- a/Content.Server/Construction/Conditions/ComponentInTile.cs
+++ b/Content.Server/Construction/Conditions/ComponentInTile.cs
@@ -46,7 +46,7 @@ namespace Content.Server.Construction.Conditions
var type = _componentFactory.GetRegistration(Component).Type;
- var indices = entity.Transform.Coordinates.ToMapIndices(entity.EntityManager, _mapManager);
+ var indices = entity.Transform.Coordinates.ToVector2i(entity.EntityManager, _mapManager);
var entities = indices.GetEntitiesInTile(entity.Transform.GridID, true, entity.EntityManager);
foreach (var ent in entities)
diff --git a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
index 849acc4219..0e1f82f04f 100644
--- a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
@@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Atmos
[RegisterComponent]
public class AirtightComponent : Component, IMapInit
{
- private (GridId, MapIndices) _lastPosition;
+ private (GridId, Vector2i) _lastPosition;
private AtmosphereSystem _atmosphereSystem = default!;
public override string Name => "Airtight";
@@ -169,7 +169,7 @@ namespace Content.Server.GameObjects.Components.Atmos
UpdatePosition(Owner.Transform.GridID, snapGrid.Position);
}
- private void UpdatePosition(GridId gridId, MapIndices pos)
+ private void UpdatePosition(GridId gridId, Vector2i pos)
{
var gridAtmos = _atmosphereSystem.GetGridAtmosphere(gridId);
diff --git a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
index 56de570197..012ad5fdb0 100644
--- a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
@@ -20,6 +20,7 @@ using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
@@ -78,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _excitedGroupLastProcess;
[ViewVariables]
- protected readonly Dictionary Tiles = new Dictionary(1000);
+ protected readonly Dictionary Tiles = new Dictionary(1000);
[ViewVariables]
private readonly HashSet _activeTiles = new HashSet(1000);
@@ -108,7 +109,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _superconductivityLastProcess;
[ViewVariables]
- private readonly HashSet _invalidatedCoords = new HashSet(1000);
+ private readonly HashSet _invalidatedCoords = new HashSet(1000);
[ViewVariables]
private int InvalidatedCoordsCount => _invalidatedCoords.Count;
@@ -162,7 +163,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
///
- public virtual void PryTile(MapIndices indices)
+ public virtual void PryTile(Vector2i indices)
{
if (IsSpace(indices) || IsAirBlocked(indices)) return;
@@ -206,7 +207,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
///
- public virtual void Invalidate(MapIndices indices)
+ public virtual void Invalidate(Vector2i indices)
{
_invalidatedCoords.Add(indices);
}
@@ -264,13 +265,13 @@ namespace Content.Server.GameObjects.Components.Atmos
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void UpdateAdjacentBits(MapIndices indices)
+ public void UpdateAdjacentBits(Vector2i indices)
{
GetTile(indices)?.UpdateAdjacent();
}
///
- public virtual void FixVacuum(MapIndices indices)
+ public virtual void FixVacuum(Vector2i indices)
{
var tile = GetTile(indices);
if (tile?.GridIndex != _gridId) return;
@@ -387,11 +388,11 @@ namespace Content.Server.GameObjects.Components.Atmos
///
public virtual TileAtmosphere? GetTile(EntityCoordinates coordinates, bool createSpace = true)
{
- return GetTile(coordinates.ToMapIndices(_serverEntityManager, _mapManager), createSpace);
+ return GetTile(coordinates.ToVector2i(_serverEntityManager, _mapManager), createSpace);
}
///
- public virtual TileAtmosphere? GetTile(MapIndices indices, bool createSpace = true)
+ public virtual TileAtmosphere? GetTile(Vector2i indices, bool createSpace = true)
{
if (Tiles.TryGetValue(indices, out var tile)) return tile;
@@ -405,7 +406,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
///
- public bool IsAirBlocked(MapIndices indices, AtmosDirection direction = AtmosDirection.All)
+ public bool IsAirBlocked(Vector2i indices, AtmosDirection direction = AtmosDirection.All)
{
foreach (var obstructingComponent in GetObstructingComponents(indices))
{
@@ -420,7 +421,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
///
- public virtual bool IsSpace(MapIndices indices)
+ public virtual bool IsSpace(Vector2i indices)
{
// TODO ATMOS use ContentTileDefinition to define in YAML whether or not a tile is considered space
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return default;
@@ -428,7 +429,7 @@ namespace Content.Server.GameObjects.Components.Atmos
return mapGrid.Grid.GetTileRef(indices).Tile.IsEmpty;
}
- public Dictionary GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false)
+ public Dictionary GetAdjacentTiles(Vector2i indices, bool includeAirBlocked = false)
{
var sides = new Dictionary();
for (var i = 0; i < Atmospherics.Directions; i++)
@@ -780,7 +781,7 @@ namespace Content.Server.GameObjects.Components.Atmos
return true;
}
- protected virtual IEnumerable GetObstructingComponents(MapIndices indices)
+ protected virtual IEnumerable GetObstructingComponents(Vector2i indices)
{
var gridLookup = EntitySystem.Get();
@@ -795,7 +796,7 @@ namespace Content.Server.GameObjects.Components.Atmos
return list;
}
- private bool NeedsVacuumFixing(MapIndices indices)
+ private bool NeedsVacuumFixing(Vector2i indices)
{
var value = false;
@@ -807,7 +808,7 @@ namespace Content.Server.GameObjects.Components.Atmos
return value;
}
- private AtmosDirection GetBlockedDirections(MapIndices indices)
+ private AtmosDirection GetBlockedDirections(Vector2i indices)
{
var value = AtmosDirection.Invalid;
@@ -833,7 +834,7 @@ namespace Content.Server.GameObjects.Components.Atmos
var gridId = mapGrid.Grid.Index;
if (!serializer.TryReadDataField("uniqueMixes", out List? uniqueMixes) ||
- !serializer.TryReadDataField("tiles", out Dictionary? tiles))
+ !serializer.TryReadDataField("tiles", out Dictionary? tiles))
return;
Tiles.Clear();
@@ -857,7 +858,7 @@ namespace Content.Server.GameObjects.Components.Atmos
{
var uniqueMixes = new List();
var uniqueMixHash = new Dictionary();
- var tiles = new Dictionary();
+ var tiles = new Dictionary();
foreach (var (indices, tile) in Tiles)
{
if (tile.Air == null) continue;
@@ -875,7 +876,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
serializer.DataField(ref uniqueMixes, "uniqueMixes", new List());
- serializer.DataField(ref tiles, "tiles", new Dictionary());
+ serializer.DataField(ref tiles, "tiles", new Dictionary());
}
}
@@ -890,7 +891,7 @@ namespace Content.Server.GameObjects.Components.Atmos
}
///
- public virtual void BurnTile(MapIndices gridIndices)
+ public virtual void BurnTile(Vector2i gridIndices)
{
// TODO ATMOS
}
diff --git a/Content.Server/GameObjects/Components/Atmos/SpaceGridAtmosphereComponent.cs b/Content.Server/GameObjects/Components/Atmos/SpaceGridAtmosphereComponent.cs
index 2ecdf11da3..5ccea7ba4e 100644
--- a/Content.Server/GameObjects/Components/Atmos/SpaceGridAtmosphereComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/SpaceGridAtmosphereComponent.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.Atmos;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Atmos
{
@@ -12,17 +13,17 @@ namespace Content.Server.GameObjects.Components.Atmos
public override void RepopulateTiles() { }
- public override bool IsSpace(MapIndices indices)
+ public override bool IsSpace(Vector2i indices)
{
return true;
}
- public override TileAtmosphere? GetTile(MapIndices indices, bool createSpace = true)
+ public override TileAtmosphere? GetTile(Vector2i indices, bool createSpace = true)
{
return new TileAtmosphere(this, GridId.Invalid, indices, new GasMixture(2500, AtmosphereSystem), true);
}
- protected override IEnumerable GetObstructingComponents(MapIndices indices)
+ protected override IEnumerable GetObstructingComponents(Vector2i indices)
{
return Enumerable.Empty();
}
diff --git a/Content.Server/GameObjects/Components/Atmos/UnsimulatedGridAtmosphereComponent.cs b/Content.Server/GameObjects/Components/Atmos/UnsimulatedGridAtmosphereComponent.cs
index cd19c5dc64..3d70a4cfaf 100644
--- a/Content.Server/GameObjects/Components/Atmos/UnsimulatedGridAtmosphereComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/UnsimulatedGridAtmosphereComponent.cs
@@ -7,6 +7,7 @@ using Content.Shared.Atmos;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Map;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Atmos
{
@@ -18,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Atmos
{
public override string Name => "UnsimulatedGridAtmosphere";
- public override void PryTile(MapIndices indices) { }
+ public override void PryTile(Vector2i indices) { }
public override void RepopulateTiles()
{
@@ -31,11 +32,11 @@ namespace Content.Server.GameObjects.Components.Atmos
}
}
- public override void Invalidate(MapIndices indices) { }
+ public override void Invalidate(Vector2i indices) { }
protected override void Revalidate() { }
- public override void FixVacuum(MapIndices indices) { }
+ public override void FixVacuum(Vector2i indices) { }
public override void AddActiveTile(TileAtmosphere? tile) { }
diff --git a/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs b/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs
index a9828dade1..ad7fd591ae 100644
--- a/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs
+++ b/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs
@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
_reactTimer = 0;
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
- var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToMapIndices(Owner.EntityManager, _mapManager));
+ var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToVector2i(Owner.EntityManager, _mapManager));
foreach (var reagentQuantity in contents.ReagentList.ToArray())
{
if (reagentQuantity.Quantity == ReagentUnit.Zero) continue;
diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs
index d1719f232a..88c3f711ab 100644
--- a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs
+++ b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs
@@ -16,6 +16,7 @@ using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -152,7 +153,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
}
- private bool IsRCDStillValid(AfterInteractEventArgs eventArgs, IMapGrid mapGrid, TileRef tile, MapIndices snapPos, RcdMode startingMode)
+ private bool IsRCDStillValid(AfterInteractEventArgs eventArgs, IMapGrid mapGrid, TileRef tile, Vector2i snapPos, RcdMode startingMode)
{
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
if (_ammo <= 0)
diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs
index 89e909c1e6..8bd0122010 100644
--- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs
+++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs
@@ -26,15 +26,15 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
public TimeSpan LastUpdate { get; private set; }
public GridId GridId { get; }
- public MapIndices Indices => _indices;
- private readonly MapIndices _indices;
+ public Vector2i Indices => _indices;
+ private readonly Vector2i _indices;
// Nodes per chunk row
public static int ChunkSize => 8;
public PathfindingNode[,] Nodes => _nodes;
private PathfindingNode[,] _nodes = new PathfindingNode[ChunkSize,ChunkSize];
- public PathfindingChunk(GridId gridId, MapIndices indices)
+ public PathfindingChunk(GridId gridId, Vector2i indices)
{
GridId = gridId;
_indices = indices;
@@ -46,7 +46,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
{
for (var y = 0; y < ChunkSize; y++)
{
- var tileRef = mapGrid.GetTileRef(new MapIndices(x + _indices.X, y + _indices.Y));
+ var tileRef = mapGrid.GetTileRef(new Vector2i(x + _indices.X, y + _indices.Y));
CreateNode(tileRef);
}
}
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
{
if (x == 0 && y == 0) continue;
var (neighborX, neighborY) = (_indices.X + ChunkSize * x, _indices.Y + ChunkSize * y);
- if (chunkGrid.TryGetValue(new MapIndices(neighborX, neighborY), out var neighbor))
+ if (chunkGrid.TryGetValue(new Vector2i(neighborX, neighborY), out var neighbor))
{
yield return neighbor;
}
@@ -83,10 +83,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
}
}
- public bool InBounds(MapIndices mapIndices)
+ public bool InBounds(Vector2i Vector2i)
{
- if (mapIndices.X < _indices.X || mapIndices.Y < _indices.Y) return false;
- if (mapIndices.X >= _indices.X + ChunkSize || mapIndices.Y >= _indices.Y + ChunkSize) return false;
+ if (Vector2i.X < _indices.X || Vector2i.Y < _indices.Y) return false;
+ if (Vector2i.X >= _indices.X + ChunkSize || Vector2i.Y >= _indices.Y + ChunkSize) return false;
return true;
}
diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingHelpers.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingHelpers.cs
index 3abd8e1966..9fd03e38d2 100644
--- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingHelpers.cs
+++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingHelpers.cs
@@ -199,7 +199,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
}
intermediate = pathfindingSystem.GetNode(grid.GetTileRef(
- new MapIndices(intermediate.TileRef.X + xOffset, intermediate.TileRef.Y + yOffset)));
+ new Vector2i(intermediate.TileRef.X + xOffset, intermediate.TileRef.Y + yOffset)));
if (intermediate.TileRef != current.TileRef)
{
diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs
index a5047294cd..69412abcfb 100644
--- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs
+++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs
@@ -69,7 +69,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
for (var y = -1; y <= 1; y++)
{
if (x == 0 && y == 0) continue;
- var indices = new MapIndices(TileRef.X + x, TileRef.Y + y);
+ var indices = new Vector2i(TileRef.X + x, TileRef.Y + y);
if (ParentChunk.InBounds(indices))
{
var (relativeX, relativeY) = (indices.X - ParentChunk.Indices.X,
@@ -100,7 +100,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
{
var chunkXOffset = TileRef.X - ParentChunk.Indices.X;
var chunkYOffset = TileRef.Y - ParentChunk.Indices.Y;
- MapIndices neighborMapIndices;
+ Vector2i neighborVector2i;
switch (direction)
{
@@ -110,13 +110,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset + 1, chunkYOffset];
}
- neighborMapIndices = new MapIndices(TileRef.X + 1, TileRef.Y);
+ neighborVector2i = new Vector2i(TileRef.X + 1, TileRef.Y);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -127,13 +127,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset + 1, chunkYOffset + 1];
}
- neighborMapIndices = new MapIndices(TileRef.X + 1, TileRef.Y + 1);
+ neighborVector2i = new Vector2i(TileRef.X + 1, TileRef.Y + 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -144,13 +144,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset, chunkYOffset + 1];
}
- neighborMapIndices = new MapIndices(TileRef.X, TileRef.Y + 1);
+ neighborVector2i = new Vector2i(TileRef.X, TileRef.Y + 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -161,13 +161,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset - 1, chunkYOffset + 1];
}
- neighborMapIndices = new MapIndices(TileRef.X - 1, TileRef.Y + 1);
+ neighborVector2i = new Vector2i(TileRef.X - 1, TileRef.Y + 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -178,13 +178,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset - 1, chunkYOffset];
}
- neighborMapIndices = new MapIndices(TileRef.X - 1, TileRef.Y);
+ neighborVector2i = new Vector2i(TileRef.X - 1, TileRef.Y);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -195,13 +195,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset - 1, chunkYOffset - 1];
}
- neighborMapIndices = new MapIndices(TileRef.X - 1, TileRef.Y - 1);
+ neighborVector2i = new Vector2i(TileRef.X - 1, TileRef.Y - 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -212,13 +212,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset, chunkYOffset - 1];
}
- neighborMapIndices = new MapIndices(TileRef.X, TileRef.Y - 1);
+ neighborVector2i = new Vector2i(TileRef.X, TileRef.Y - 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
@@ -229,13 +229,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
return ParentChunk.Nodes[chunkXOffset + 1, chunkYOffset - 1];
}
- neighborMapIndices = new MapIndices(TileRef.X + 1, TileRef.Y - 1);
+ neighborVector2i = new Vector2i(TileRef.X + 1, TileRef.Y - 1);
foreach (var neighbor in ParentChunk.GetNeighbors())
{
- if (neighbor.InBounds(neighborMapIndices))
+ if (neighbor.InBounds(neighborVector2i))
{
- return neighbor.Nodes[neighborMapIndices.X - neighbor.Indices.X,
- neighborMapIndices.Y - neighbor.Indices.Y];
+ return neighbor.Nodes[neighborVector2i.X - neighbor.Indices.X,
+ neighborVector2i.Y - neighbor.Indices.Y];
}
}
diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs
index 44e868cea1..a19384fe63 100644
--- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs
@@ -13,6 +13,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
@@ -32,8 +33,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
- public IReadOnlyDictionary> Graph => _graph;
- private readonly Dictionary> _graph = new Dictionary>();
+ public IReadOnlyDictionary> Graph => _graph;
+ private readonly Dictionary> _graph = new Dictionary>();
private readonly PathfindingJobQueue _pathfindingQueue = new PathfindingJobQueue();
@@ -144,28 +145,28 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
{
var chunkX = (int) (Math.Floor((float) tile.X / PathfindingChunk.ChunkSize) * PathfindingChunk.ChunkSize);
var chunkY = (int) (Math.Floor((float) tile.Y / PathfindingChunk.ChunkSize) * PathfindingChunk.ChunkSize);
- var mapIndices = new MapIndices(chunkX, chunkY);
+ var Vector2i = new Vector2i(chunkX, chunkY);
if (_graph.TryGetValue(tile.GridIndex, out var chunks))
{
- if (!chunks.ContainsKey(mapIndices))
+ if (!chunks.ContainsKey(Vector2i))
{
- CreateChunk(tile.GridIndex, mapIndices);
+ CreateChunk(tile.GridIndex, Vector2i);
}
- return chunks[mapIndices];
+ return chunks[Vector2i];
}
- var newChunk = CreateChunk(tile.GridIndex, mapIndices);
+ var newChunk = CreateChunk(tile.GridIndex, Vector2i);
return newChunk;
}
- private PathfindingChunk CreateChunk(GridId gridId, MapIndices indices)
+ private PathfindingChunk CreateChunk(GridId gridId, Vector2i indices)
{
var newChunk = new PathfindingChunk(gridId, indices);
if (!_graph.ContainsKey(gridId))
{
- _graph.Add(gridId, new Dictionary());
+ _graph.Add(gridId, new Dictionary());
}
_graph[gridId].Add(indices, newChunk);
diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs
index 55a7415b28..66ba670267 100644
--- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs
@@ -603,10 +603,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
return Vector2.Zero;
}
- if (target.TryGetComponent(out ICollidableComponent physicsComponent))
+ if (target.TryGetComponent(out ICollidableComponent collidable))
{
var targetDistance = (targetPos.Position - entityPos.Position);
- targetPos = targetPos.Offset(physicsComponent.LinearVelocity * targetDistance);
+ targetPos = targetPos.Offset(collidable.LinearVelocity * targetDistance);
}
return (targetPos.Position - entityPos.Position).Normalized;
@@ -662,8 +662,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
// if we're moving in the same direction then ignore
// So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction
// i.e. towards the right
- if (physicsEntity.TryGetComponent(out ICollidableComponent physicsComponent) &&
- Vector2.Dot(physicsComponent.LinearVelocity, direction) > 0)
+ if (physicsEntity.TryGetComponent(out ICollidableComponent collidable) &&
+ Vector2.Dot(collidable.LinearVelocity, direction) > 0)
{
continue;
}
diff --git a/Content.Server/GameObjects/EntitySystems/Atmos/AtmosDebugOverlaySystem.cs b/Content.Server/GameObjects/EntitySystems/Atmos/AtmosDebugOverlaySystem.cs
index 1187eb393d..e7b0380d1a 100644
--- a/Content.Server/GameObjects/EntitySystems/Atmos/AtmosDebugOverlaySystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/Atmos/AtmosDebugOverlaySystem.cs
@@ -120,7 +120,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
if (!gridEnt.TryGetComponent(out var gam)) continue;
var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices;
- var baseTile = new MapIndices(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
+ var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange];
var index = 0;
@@ -128,8 +128,8 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
{
for (var x = 0; x < LocalViewRange; x++)
{
- var mapIndices = new MapIndices(baseTile.X + x, baseTile.Y + y);
- debugOverlayContent[index++] = ConvertTileToData(gam.GetTile(mapIndices));
+ var Vector2i = new Vector2i(baseTile.X + x, baseTile.Y + y);
+ debugOverlayContent[index++] = ConvertTileToData(gam.GetTile(Vector2i));
}
}
diff --git a/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs b/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs
index 5318126016..7819bf48ee 100644
--- a/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
///
/// The tiles that have had their atmos data updated since last tick
///
- private Dictionary> _invalidTiles = new Dictionary>();
+ private Dictionary> _invalidTiles = new Dictionary>();
private Dictionary _knownPlayerChunks =
new Dictionary();
@@ -39,8 +39,8 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
///
/// Gas data stored in chunks to make PVS / bubbling easier.
///
- private Dictionary> _overlay =
- new Dictionary>();
+ private Dictionary> _overlay =
+ new Dictionary>();
///
/// How far away do we update gas overlays (minimum; due to chunking further away tiles may also be updated).
@@ -75,22 +75,22 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Invalidate(GridId gridIndex, MapIndices indices)
+ public void Invalidate(GridId gridIndex, Vector2i indices)
{
if (!_invalidTiles.TryGetValue(gridIndex, out var existing))
{
- existing = new HashSet();
+ existing = new HashSet();
_invalidTiles[gridIndex] = existing;
}
existing.Add(indices);
}
- private GasOverlayChunk GetOrCreateChunk(GridId gridIndex, MapIndices indices)
+ private GasOverlayChunk GetOrCreateChunk(GridId gridIndex, Vector2i indices)
{
if (!_overlay.TryGetValue(gridIndex, out var chunks))
{
- chunks = new Dictionary();
+ chunks = new Dictionary();
_overlay[gridIndex] = chunks;
}
@@ -150,7 +150,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
///
///
/// true if updated
- private bool TryRefreshTile(GridAtmosphereComponent gam, GasOverlayData oldTile, MapIndices indices, out GasOverlayData overlayData)
+ private bool TryRefreshTile(GridAtmosphereComponent gam, GasOverlayData oldTile, Vector2i indices, out GasOverlayData overlayData)
{
var tile = gam.GetTile(indices);
@@ -214,7 +214,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
{
for (var y = -maxYDiff; y <= maxYDiff; y++)
{
- var chunkIndices = GetGasChunkIndices(new MapIndices(entityTile.X + x * ChunkSize, entityTile.Y + y * ChunkSize));
+ var chunkIndices = GetGasChunkIndices(new Vector2i(entityTile.X + x * ChunkSize, entityTile.Y + y * ChunkSize));
if (!chunks.TryGetValue(chunkIndices, out var chunk)) continue;
@@ -261,7 +261,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
AccumulatedFrameTime -= _updateCooldown;
var gridAtmosComponents = new Dictionary();
- var updatedTiles = new Dictionary>();
+ var updatedTiles = new Dictionary>();
// So up to this point we've been caching the updated tiles for multiple ticks.
// Now we'll go through and check whether the update actually matters for the overlay or not,
@@ -295,7 +295,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
if (!updatedTiles.TryGetValue(chunk, out var tiles))
{
- tiles = new HashSet();
+ tiles = new HashSet();
updatedTiles[chunk] = tiles;
}
@@ -355,7 +355,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
overlay.RemoveChunk(chunk);
}
- var clientInvalids = new Dictionary>();
+ var clientInvalids = new Dictionary>();
// Check for any dirty chunks in range and bundle the data to send to the client.
foreach (var chunk in chunksInRange)
@@ -364,7 +364,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
if (!clientInvalids.TryGetValue(chunk.GridIndices, out var existingData))
{
- existingData = new List<(MapIndices, GasOverlayData)>();
+ existingData = new List<(Vector2i, GasOverlayData)>();
clientInvalids[chunk.GridIndices] = existingData;
}
@@ -382,13 +382,13 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
}
private sealed class PlayerGasOverlay
{
- private readonly Dictionary> _data =
- new Dictionary>();
+ private readonly Dictionary> _data =
+ new Dictionary>();
private readonly Dictionary _lastSent =
new Dictionary();
- public GasOverlayMessage UpdateClient(GridId grid, List<(MapIndices, GasOverlayData)> data)
+ public GasOverlayMessage UpdateClient(GridId grid, List<(Vector2i, GasOverlayData)> data)
{
return new GasOverlayMessage(grid, data);
}
@@ -418,7 +418,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
{
if (!_data.TryGetValue(chunk.GridIndices, out var chunks))
{
- chunks = new Dictionary();
+ chunks = new Dictionary();
_data[chunk.GridIndices] = chunks;
}
@@ -441,9 +441,9 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
return;
}
- if (chunks.ContainsKey(chunk.MapIndices))
+ if (chunks.ContainsKey(chunk.Vector2i))
{
- chunks.Remove(chunk.MapIndices);
+ chunks.Remove(chunk.Vector2i);
}
}
@@ -457,7 +457,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
// Chunk data should already be up to date.
// Only send relevant tiles to client.
- var tileData = new List<(MapIndices, GasOverlayData)>();
+ var tileData = new List<(Vector2i, GasOverlayData)>();
for (var x = 0; x < ChunkSize; x++)
{
@@ -470,7 +470,7 @@ namespace Content.Server.GameObjects.EntitySystems.Atmos
continue;
}
- var indices = new MapIndices(chunk.MapIndices.X + x, chunk.MapIndices.Y + y);
+ var indices = new Vector2i(chunk.Vector2i.X + x, chunk.Vector2i.Y + y);
tileData.Add((indices, data));
}
}
diff --git a/Content.Server/Throw/ThrowHelper.cs b/Content.Server/Throw/ThrowHelper.cs
index 669b1c8f02..567325c070 100644
--- a/Content.Server/Throw/ThrowHelper.cs
+++ b/Content.Server/Throw/ThrowHelper.cs
@@ -139,9 +139,9 @@ namespace Content.Server.Throw
var throwDuration = ThrownItemComponent.DefaultThrowTime;
var mass = 1f;
- if (thrownEnt.TryGetComponent(out ICollidableComponent physicsComponent))
+ if (thrownEnt.TryGetComponent(out ICollidableComponent collidable))
{
- mass = physicsComponent.Mass;
+ mass = collidable.Mass;
}
var velocityNecessary = distance / throwDuration;
diff --git a/Content.Server/Utility/GridTileLookupHelpers.cs b/Content.Server/Utility/GridTileLookupHelpers.cs
index 971ff6d0c7..d6597a51e1 100644
--- a/Content.Server/Utility/GridTileLookupHelpers.cs
+++ b/Content.Server/Utility/GridTileLookupHelpers.cs
@@ -8,6 +8,7 @@ using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
namespace Content.Server.Utility
{
@@ -28,7 +29,7 @@ namespace Content.Server.Utility
/// Helper that returns all entities in a turf.
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static IEnumerable GetEntitiesInTileFast(this MapIndices indices, GridId gridId, GridTileLookupSystem? gridTileLookup = null)
+ public static IEnumerable GetEntitiesInTileFast(this Vector2i indices, GridId gridId, GridTileLookupSystem? gridTileLookup = null)
{
gridTileLookup ??= EntitySystem.Get();
return gridTileLookup.GetEntitiesIntersecting(gridId, indices);
diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs
index 67ef3bfa86..42c6ea5117 100644
--- a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs
+++ b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -11,20 +12,20 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
/// Grid for this chunk
///
public GridId GridIndices { get; }
-
+
///
/// Origin of this chunk
///
- public MapIndices MapIndices { get; }
-
+ public Vector2i Vector2i { get; }
+
public SharedGasTileOverlaySystem.GasOverlayData[,] TileData = new SharedGasTileOverlaySystem.GasOverlayData[SharedGasTileOverlaySystem.ChunkSize, SharedGasTileOverlaySystem.ChunkSize];
public GameTick LastUpdate { get; private set; }
- public GasOverlayChunk(GridId gridIndices, MapIndices mapIndices)
+ public GasOverlayChunk(GridId gridIndices, Vector2i Vector2i)
{
GridIndices = gridIndices;
- MapIndices = mapIndices;
+ Vector2i = Vector2i;
}
public void Dirty(GameTick currentTick)
@@ -37,12 +38,12 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
///
///
///
- public void Update(SharedGasTileOverlaySystem.GasOverlayData data, MapIndices indices)
+ public void Update(SharedGasTileOverlaySystem.GasOverlayData data, Vector2i indices)
{
DebugTools.Assert(InBounds(indices));
- var (offsetX, offsetY) = (indices.X - MapIndices.X,
- indices.Y - MapIndices.Y);
-
+ var (offsetX, offsetY) = (indices.X - Vector2i.X,
+ indices.Y - Vector2i.Y);
+
TileData[offsetX, offsetY] = data;
}
@@ -64,7 +65,7 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
}
}
- public void GetData(List<(MapIndices, SharedGasTileOverlaySystem.GasOverlayData)> existingData, HashSet indices)
+ public void GetData(List<(Vector2i, SharedGasTileOverlaySystem.GasOverlayData)> existingData, HashSet indices)
{
foreach (var index in indices)
{
@@ -72,28 +73,28 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
}
}
- public IEnumerable GetAllIndices()
+ public IEnumerable GetAllIndices()
{
for (var x = 0; x < SharedGasTileOverlaySystem.ChunkSize; x++)
{
for (var y = 0; y < SharedGasTileOverlaySystem.ChunkSize; y++)
{
- yield return new MapIndices(MapIndices.X + x, MapIndices.Y + y);
+ yield return new Vector2i(Vector2i.X + x, Vector2i.Y + y);
}
}
}
- public SharedGasTileOverlaySystem.GasOverlayData GetData(MapIndices indices)
+ public SharedGasTileOverlaySystem.GasOverlayData GetData(Vector2i indices)
{
DebugTools.Assert(InBounds(indices));
- return TileData[indices.X - MapIndices.X, indices.Y - MapIndices.Y];
+ return TileData[indices.X - Vector2i.X, indices.Y - Vector2i.Y];
}
- private bool InBounds(MapIndices indices)
+ private bool InBounds(Vector2i indices)
{
- if (indices.X < MapIndices.X || indices.Y < MapIndices.Y) return false;
- if (indices.X >= MapIndices.X + SharedGasTileOverlaySystem.ChunkSize || indices.Y >= MapIndices.Y + SharedGasTileOverlaySystem.ChunkSize) return false;
+ if (indices.X < Vector2i.X || indices.Y < Vector2i.Y) return false;
+ if (indices.X >= Vector2i.X + SharedGasTileOverlaySystem.ChunkSize || indices.Y >= Vector2i.Y + SharedGasTileOverlaySystem.ChunkSize) return false;
return true;
}
}
-}
\ No newline at end of file
+}
diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs
index ccf802dd35..1afbd55e32 100644
--- a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs
+++ b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs
@@ -6,6 +6,7 @@ using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Content.Shared.Atmos;
+using Robust.Shared.Maths;
namespace Content.Shared.GameObjects.EntitySystems.Atmos
{
@@ -41,11 +42,11 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
{
public GridId GridId { get; }
- public MapIndices BaseIdx { get; }
+ public Vector2i BaseIdx { get; }
// LocalViewRange*LocalViewRange
public AtmosDebugOverlayData[] OverlayData { get; }
- public AtmosDebugOverlayMessage(GridId gridIndices, MapIndices baseIdx, AtmosDebugOverlayData[] overlayData)
+ public AtmosDebugOverlayMessage(GridId gridIndices, Vector2i baseIdx, AtmosDebugOverlayData[] overlayData)
{
GridId = gridIndices;
BaseIdx = baseIdx;
diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs
index 3c4da94616..94b29f9c65 100644
--- a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs
+++ b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Map;
+using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
@@ -13,9 +14,9 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
public const byte ChunkSize = 8;
protected float AccumulatedFrameTime;
- public static MapIndices GetGasChunkIndices(MapIndices indices)
+ public static Vector2i GetGasChunkIndices(Vector2i indices)
{
- return new MapIndices((int) Math.Floor((float) indices.X / ChunkSize) * ChunkSize, (int) MathF.Floor((float) indices.Y / ChunkSize) * ChunkSize);
+ return new Vector2i((int) Math.Floor((float) indices.X / ChunkSize) * ChunkSize, (int) MathF.Floor((float) indices.Y / ChunkSize) * ChunkSize);
}
[Serializable, NetSerializable]
@@ -85,9 +86,9 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
{
public GridId GridId { get; }
- public List<(MapIndices, GasOverlayData)> OverlayData { get; }
+ public List<(Vector2i, GasOverlayData)> OverlayData { get; }
- public GasOverlayMessage(GridId gridIndices, List<(MapIndices,GasOverlayData)> overlayData)
+ public GasOverlayMessage(GridId gridIndices, List<(Vector2i,GasOverlayData)> overlayData)
{
GridId = gridIndices;
OverlayData = overlayData;
diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs
index b246b24c7e..6df3c78180 100644
--- a/Content.Shared/Maps/TurfHelpers.cs
+++ b/Content.Shared/Maps/TurfHelpers.cs
@@ -28,7 +28,7 @@ namespace Content.Shared.Maps
///
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
///
- public static TileRef GetTileRef(this MapIndices mapIndices, GridId gridId, IMapManager? mapManager = null)
+ public static TileRef GetTileRef(this Vector2i Vector2i, GridId gridId, IMapManager? mapManager = null)
{
if (!gridId.IsValid())
return default;
@@ -38,7 +38,7 @@ namespace Content.Shared.Maps
if (!mapManager.TryGetGrid(gridId, out var grid))
return default;
- if (!grid.TryGetTileRef(mapIndices, out var tile))
+ if (!grid.TryGetTileRef(Vector2i, out var tile))
return default;
return tile;
@@ -76,10 +76,10 @@ namespace Content.Shared.Maps
entityManager ??= IoCManager.Resolve();
mapManager ??= IoCManager.Resolve();
- return coordinates.ToMapIndices(entityManager, mapManager).PryTile(coordinates.GetGridId(entityManager));
+ return coordinates.ToVector2i(entityManager, mapManager).PryTile(coordinates.GetGridId(entityManager));
}
- public static bool PryTile(this MapIndices indices, GridId gridId,
+ public static bool PryTile(this Vector2i indices, GridId gridId,
IMapManager? mapManager = null, ITileDefinitionManager? tileDefinitionManager = null, IEntityManager? entityManager = null)
{
mapManager ??= IoCManager.Resolve();
@@ -114,7 +114,7 @@ namespace Content.Shared.Maps
var half = mapGrid.TileSize / 2f;
//Actually spawn the relevant tile item at the right position and give it some random offset.
- var tileItem = entityManager.SpawnEntity(tileDef.ItemDropPrototypeName, indices.ToEntityCoordinates(mapManager, tileRef.GridIndex).Offset(new Vector2(half, half)));
+ var tileItem = entityManager.SpawnEntity(tileDef.ItemDropPrototypeName, indices.ToEntityCoordinates(tileRef.GridIndex, mapManager).Offset(new Vector2(half, half)));
tileItem.RandomOffset(0.25f);
return true;
}
@@ -146,7 +146,7 @@ namespace Content.Shared.Maps
///
/// Helper that returns all entities in a turf.
///
- public static IEnumerable GetEntitiesInTile(this MapIndices indices, GridId gridId, bool approximate = false, IEntityManager? entityManager = null)
+ public static IEnumerable GetEntitiesInTile(this Vector2i indices, GridId gridId, bool approximate = false, IEntityManager? entityManager = null)
{
return GetEntitiesInTile(indices.GetTileRef(gridId), approximate, entityManager);
}
@@ -178,7 +178,7 @@ namespace Content.Shared.Maps
{
mapManager ??= IoCManager.Resolve();
- return turf.GridIndices.ToEntityCoordinates(mapManager, turf.GridIndex);
+ return turf.GridIndices.ToEntityCoordinates(turf.GridIndex, mapManager);
}
///
diff --git a/RobustToolbox b/RobustToolbox
index cabb9859ec..5bbcdbd3ef 160000
--- a/RobustToolbox
+++ b/RobustToolbox
@@ -1 +1 @@
-Subproject commit cabb9859eca718a9842c9ed9332f09b47fb5d967
+Subproject commit 5bbcdbd3ef3ebe3ab526cb5ad9576b18fd9c400b