Content changes for mapgrid kill (#12567)

This commit is contained in:
metalgearsloth
2022-11-22 13:12:04 +11:00
committed by GitHub
parent 9170e7ac9d
commit 6c76061887
75 changed files with 192 additions and 123 deletions

View File

@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
@@ -16,7 +17,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class AddAtmosWindow : DefaultWindow
{
private IEnumerable<IMapGrid>? _data;
private IEnumerable<MapGridComponent>? _data;
protected override void EnteredTree()
{

View File

@@ -11,6 +11,7 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
@@ -18,7 +19,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class AddGasWindow : DefaultWindow
{
private IEnumerable<IMapGrid>? _gridData;
private IEnumerable<MapGridComponent>? _gridData;
private IEnumerable<GasPrototype>? _gasData;
protected override void EnteredTree()

View File

@@ -11,6 +11,7 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
@@ -18,7 +19,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class FillGasWindow : DefaultWindow
{
private IEnumerable<IMapGrid>? _gridData;
private IEnumerable<MapGridComponent>? _gridData;
private IEnumerable<GasPrototype>? _gasData;
protected override void EnteredTree()

View File

@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
@@ -16,7 +17,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class SetTemperatureWindow : DefaultWindow
{
private IEnumerable<IMapGrid>? _data;
private IEnumerable<MapGridComponent>? _data;
protected override void EnteredTree()
{

View File

@@ -4,6 +4,7 @@ using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map.Components;
namespace Content.Client.Administration.UI.Tabs.ObjectsTab;

View File

@@ -1,6 +1,7 @@
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using static Robust.Client.GameObjects.SpriteComponent;
namespace Content.Client.IconSmoothing
@@ -185,7 +186,7 @@ namespace Content.Client.IconSmoothing
var xform = xformQuery.GetComponent(uid);
IMapGrid? grid = null;
MapGridComponent? grid = null;
if (xform.Anchored)
{
@@ -209,7 +210,7 @@ namespace Content.Client.IconSmoothing
}
}
private void CalculateNewSpriteCardinal(IMapGrid? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
private void CalculateNewSpriteCardinal(MapGridComponent? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
var dirs = CardinalConnectDirs.None;
@@ -243,7 +244,7 @@ namespace Content.Client.IconSmoothing
return false;
}
private void CalculateNewSpriteCorners(IMapGrid? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
private void CalculateNewSpriteCorners(MapGridComponent? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
var (cornerNE, cornerNW, cornerSW, cornerSE) = grid == null
? (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None)
@@ -260,7 +261,7 @@ namespace Content.Client.IconSmoothing
sprite.LayerSetState(CornerLayers.NW, $"{smooth.StateBase}{(int) cornerNW}");
}
private (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid, IconSmoothComponent smooth, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
private (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(MapGridComponent grid, IconSmoothComponent smooth, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
var pos = grid.TileIndicesFor(xform.Coordinates);
var n = MatchingEntity(smooth, grid.GetAnchoredEntities(pos.Offset(Direction.North)), smoothQuery);

View File

@@ -23,6 +23,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
@@ -752,7 +753,7 @@ public sealed class PoolSettings
public sealed class TestMapData
{
public MapId MapId { get; set; }
public IMapGrid MapGrid { get; set; }
public MapGridComponent MapGrid { get; set; }
public EntityCoordinates GridCoords { get; set; }
public MapCoordinates MapCoords { get; set; }
public TileRef Tile { get; set; }

View File

@@ -6,6 +6,7 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.IntegrationTests.Tests.DeviceNetwork
{
@@ -189,7 +190,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
DeviceNetworkComponent networkComponent1 = null;
DeviceNetworkComponent networkComponent2 = null;
WiredNetworkComponent wiredNetworkComponent = null;
IMapGrid grid = testMap.MapGrid;
MapGridComponent grid = testMap.MapGrid;
var testValue = "test";
var payload = new NetworkPayload

View File

@@ -9,6 +9,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
@@ -129,7 +130,7 @@ namespace Content.IntegrationTests.Tests
var componentFactory = server.ResolveDependency<IComponentFactory>();
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
IMapGrid grid = default;
MapGridComponent grid = default;
await server.WaitPost(() =>
{
@@ -224,7 +225,7 @@ namespace Content.IntegrationTests.Tests
var componentFactory = server.ResolveDependency<IComponentFactory>();
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
IMapGrid grid = default;
MapGridComponent grid = default;
await server.WaitPost(() =>
{

View File

@@ -9,6 +9,7 @@ using Content.Shared.FixedPoint;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
@@ -18,7 +19,7 @@ namespace Content.IntegrationTests.Tests.Fluids;
[TestOf(typeof(FluidSpreaderSystem))]
public sealed class FluidSpill
{
private static PuddleComponent? GetPuddle(IEntityManager entityManager, IMapGrid mapGrid, Vector2i pos)
private static PuddleComponent? GetPuddle(IEntityManager entityManager, MapGridComponent mapGrid, Vector2i pos)
{
foreach (var uid in mapGrid.GetAnchoredEntities(pos))
{

View File

@@ -8,6 +8,7 @@ using Content.Shared.FixedPoint;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.Fluids
@@ -54,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Fluids
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
var spillSystem = entitySystemManager.GetEntitySystem<SpillableSystem>();
IMapGrid grid = null;
MapGridComponent grid = null;
// Remove all tiles
await server.WaitPost(() =>
@@ -93,7 +94,7 @@ namespace Content.IntegrationTests.Tests.Fluids
var metaSystem = entityManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
MapId sMapId = default;
IMapGrid sGrid;
MapGridComponent sGrid;
EntityUid sGridId = default;
EntityCoordinates sCoordinates = default;

View File

@@ -7,6 +7,7 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.IntegrationTests.Tests
{
@@ -38,8 +39,8 @@ namespace Content.IntegrationTests.Tests
EntityUid generator = default;
var entityMan = server.ResolveDependency<IEntityManager>();
IMapGrid grid1 = null;
IMapGrid grid2 = null;
MapGridComponent grid1 = null;
MapGridComponent grid2 = null;
// Create grids
await server.WaitAssertion(() =>

View File

@@ -8,6 +8,7 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager;
@@ -87,7 +88,7 @@ public sealed class PrototypeSaveTest
var compFact = server.ResolveDependency<IComponentFactory>();
var prototypes = new List<EntityPrototype>();
IMapGrid grid = default!;
MapGridComponent grid = default!;
EntityUid uid;
MapId mapId = default;

View File

@@ -6,6 +6,7 @@ using Content.Shared.Decals;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -43,7 +44,7 @@ namespace Content.MapRenderer.Painters
_decals = GetDecals();
}
public void Run(Image gridCanvas, IMapGrid grid)
public void Run(Image gridCanvas, MapGridComponent grid)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
@@ -136,7 +137,7 @@ namespace Content.MapRenderer.Painters
return decals;
}
private (float x, float y) TransformLocalPosition(Vector2 position, IMapGrid grid)
private (float x, float y) TransformLocalPosition(Vector2 position, MapGridComponent grid)
{
var xOffset = (int) -grid.LocalAABB.Left;
var yOffset = (int) -grid.LocalAABB.Bottom;

View File

@@ -9,6 +9,7 @@ using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using SixLabors.ImageSharp;
@@ -59,7 +60,7 @@ namespace Content.MapRenderer.Painters
var tilePainter = new TilePainter(client, server);
var entityPainter = new GridPainter(client, server);
IMapGrid[] grids = null!;
MapGridComponent[] grids = null!;
var xformQuery = sEntityManager.GetEntityQuery<TransformComponent>();
await server.WaitPost(() =>

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
@@ -26,7 +27,7 @@ namespace Content.MapRenderer.Painters
_cResourceCache = client.ResolveDependency<IResourceCache>();
}
public void Run(Image gridCanvas, IMapGrid grid)
public void Run(Image gridCanvas, MapGridComponent grid)
{
var stopwatch = new Stopwatch();
stopwatch.Start();

View File

@@ -4,6 +4,7 @@ using Content.Server.Explosion.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
namespace Content.Server.AME
@@ -37,7 +38,7 @@ namespace Content.Server.AME
base.LoadNodes(groupNodes);
var mapManager = IoCManager.Resolve<IMapManager>();
IMapGrid? grid = null;
MapGridComponent? grid = null;
foreach (var node in groupNodes)
{

View File

@@ -2,6 +2,7 @@
using Content.Shared.Maps;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
namespace Content.Server.Administration.Commands;
@@ -38,11 +39,11 @@ public sealed class VariantizeCommand : IConsoleCommand
return;
}
foreach (var tile in gridComp.Grid.GetAllTiles())
foreach (var tile in gridComp.GetAllTiles())
{
var def = tile.GetContentTileDefinition();
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
gridComp.Grid.SetTile(tile.GridIndices, newTile);
gridComp.SetTile(tile.GridIndices, newTile);
}
}
}

View File

@@ -1,6 +1,7 @@
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Network;
namespace Content.Server.Administration.Systems;

View File

@@ -45,6 +45,7 @@ using Content.Shared.Tabletop.Components;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;

View File

@@ -30,6 +30,7 @@ using Content.Shared.Weapons.Ranged.Components;
using Robust.Server.GameObjects;
using Robust.Server.Physics;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Commands
{

View File

@@ -4,6 +4,7 @@ using Content.Shared.Administration;
using Content.Shared.Atmos;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.Commands
{

View File

@@ -3,6 +3,7 @@ using Content.Server.Explosion.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems
{
@@ -58,7 +59,7 @@ namespace Content.Server.Atmos.EntitySystems
var gridId = xform.GridUid;
var coords = xform.Coordinates;
var tilePos = grid.Grid.TileIndicesFor(coords);
var tilePos = grid.TileIndicesFor(coords);
// Update and invalidate new position.
airtight.LastPosition = (gridId.Value, tilePos);

View File

@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server.Atmos.Components;
using Robust.Shared.Map;
using Robust.Shared.Map.Enumerators;
namespace Content.Server.Atmos.EntitySystems;

View File

@@ -4,6 +4,7 @@ using Content.Server.Atmos.Reactions;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
namespace Content.Server.Atmos.EntitySystems;

View File

@@ -6,6 +6,7 @@ using Content.Shared.Atmos;
using Content.Shared.Maps;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems;
@@ -100,7 +101,7 @@ public sealed partial class AtmosphereSystem
tile.Clear();
var mixtureId = 0;
foreach (var entUid in gridComp.Grid.GetAnchoredEntities(indices))
foreach (var entUid in gridComp.GetAnchoredEntities(indices))
{
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
continue;

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions;
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
namespace Content.Server.Atmos.EntitySystems;
@@ -53,7 +54,7 @@ public sealed partial class AtmosphereSystem
tile.GridIndex = uid;
}
GridRepopulateTiles(mapGrid.Grid, gridAtmosphere);
GridRepopulateTiles(mapGrid, gridAtmosphere);
}
private void OnGridSplit(EntityUid uid, GridAtmosphereComponent originalGridAtmos, ref GridSplitEvent args)
@@ -230,7 +231,7 @@ public sealed partial class AtmosphereSystem
var directions = AtmosDirection.Invalid;
var enumerator = GetObstructingComponentsEnumerator(mapGridComp.Grid, args.Tile);
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, args.Tile);
while (enumerator.MoveNext(out var obstructingComponent))
{
@@ -332,7 +333,7 @@ public sealed partial class AtmosphereSystem
return;
tile.AdjacentBits = AtmosDirection.Invalid;
tile.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, tile.GridIndices);
tile.BlockedAirflow = GetBlockedDirections(mapGridComp, tile.GridIndices);
for (var i = 0; i < Atmospherics.Directions; i++)
{
@@ -349,7 +350,7 @@ public sealed partial class AtmosphereSystem
var oppositeDirection = direction.GetOpposite();
adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, adjacent.GridIndices);
adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp, adjacent.GridIndices);
// Pass in MapGridComponent so we don't have to resolve it for every adjacent direction.
var tileBlockedEv = new IsTileAirBlockedMethodEvent(uid, tile.GridIndices, direction, mapGridComp);
@@ -456,7 +457,7 @@ public sealed partial class AtmosphereSystem
tile.Air = new GasMixture
{
Volume = GetVolumeForTiles(mapGridComp.Grid, 1),
Volume = GetVolumeForTiles(mapGridComp, 1),
Temperature = Atmospherics.T20C
};
@@ -533,7 +534,7 @@ public sealed partial class AtmosphereSystem
/// </summary>
/// <param name="mapGrid">The grid where to get all valid tiles from.</param>
/// <param name="gridAtmosphere">The grid atmosphere where the tiles will be repopulated.</param>
private void GridRepopulateTiles(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere)
private void GridRepopulateTiles(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere)
{
var volume = GetVolumeForTiles(mapGrid, 1);

View File

@@ -8,6 +8,7 @@ using Robust.Shared.Physics.Components;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using System.Linq;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems
{
@@ -25,7 +26,7 @@ namespace Content.Server.Atmos.EntitySystems
private readonly TileAtmosphere[] _depressurizeSpaceTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit];
private readonly TileAtmosphere[] _depressurizeProgressionOrder = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit * 2];
private void EqualizePressureInZone(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
private void EqualizePressureInZone(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
{
if (tile.Air == null || (tile.MonstermosInfo.LastCycle >= cycleNum))
return; // Already done.
@@ -354,7 +355,7 @@ namespace Content.Server.Atmos.EntitySystems
Array.Clear(_equalizeQueue, 0, Atmospherics.MonstermosTileLimit);
}
private void ExplosivelyDepressurize(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
private void ExplosivelyDepressurize(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
{
// Check if explosive depressurization is enabled and if the tile is valid.
if (!MonstermosDepressurization || tile.Air == null)
@@ -603,7 +604,7 @@ namespace Content.Server.Atmos.EntitySystems
adj.MonstermosInfo[direction.GetOpposite()] -= amount;
}
private void HandleDecompressionFloorRip(IMapGrid mapGrid, TileAtmosphere tile, float sum)
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float sum)
{
if (!MonstermosRipTiles)
return;

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
@@ -48,17 +49,16 @@ namespace Content.Server.Atmos.EntitySystems
if (!TryComp(uid, out MapGridComponent? mapGridComp))
return true;
var mapGrid = mapGridComp.Grid;
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
var volume = GetVolumeForTiles(mapGrid, 1);
var volume = GetVolumeForTiles(mapGridComp, 1);
var number = 0;
while (atmosphere.CurrentRunInvalidatedCoordinates.TryDequeue(out var indices))
{
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
{
tile = new TileAtmosphere(mapGrid.GridEntityId, indices,
tile = new TileAtmosphere(mapGridComp.GridEntityId, indices,
new GasMixture(volume) { Temperature = Atmospherics.T20C });
atmosphere.Tiles[indices] = tile;
}
@@ -78,7 +78,7 @@ namespace Content.Server.Atmos.EntitySystems
}
// Call this instead of the grid method as the map has a say on whether the tile is space or not.
if ((!mapGrid.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
if ((!mapGridComp.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
{
tile.Air = GetTileMixture(null, mapUid, indices);
tile.MolesArchived = tile.Air != null ? new float[Atmospherics.AdjustedNumberOfGases] : null;
@@ -87,7 +87,7 @@ namespace Content.Server.Atmos.EntitySystems
{
var nullAir = false;
var enumerator = GetObstructingComponentsEnumerator(mapGrid, indices);
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, indices);
while (enumerator.MoveNext(out var airtight))
{
@@ -109,7 +109,7 @@ namespace Content.Server.Atmos.EntitySystems
}
else
{
if (tile.Air == null && NeedsVacuumFixing(mapGrid, indices))
if (tile.Air == null && NeedsVacuumFixing(mapGridComp, indices))
{
var vacuumEv = new FixTileVacuumMethodEvent(uid, indices);
GridFixTileVacuum(uid, atmosphere, ref vacuumEv);
@@ -133,12 +133,12 @@ namespace Content.Server.Atmos.EntitySystems
AddActiveTile(atmosphere, tile);
// TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity and heat capacity
var tileDef = mapGrid.TryGetTileRef(indices, out var tileRef)
var tileDef = mapGridComp.TryGetTileRef(indices, out var tileRef)
? tileRef.GetContentTileDefinition(_tileDefinitionManager) : null;
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
InvalidateVisuals(mapGrid.GridEntityId, indices);
InvalidateVisuals(mapGridComp.GridEntityId, indices);
for (var i = 0; i < Atmospherics.Directions; i++)
{
@@ -171,12 +171,10 @@ namespace Content.Server.Atmos.EntitySystems
if (!TryComp(uid, out MapGridComponent? mapGridComp))
throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!");
var mapGrid = mapGridComp.Grid;
var number = 0;
while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
{
EqualizePressureInZone(mapGrid, atmosphere, tile, atmosphere.UpdateCounter);
EqualizePressureInZone(mapGridComp, atmosphere, tile, atmosphere.UpdateCounter);
if (number++ < LagCheckIterations) continue;
number = 0;

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems;
@@ -38,7 +39,7 @@ public partial class AtmosphereSystem
_gasTileOverlaySystem.Invalidate(gridUid, tile);
}
public bool NeedsVacuumFixing(IMapGrid mapGrid, Vector2i indices)
public bool NeedsVacuumFixing(MapGridComponent mapGrid, Vector2i indices)
{
var value = false;
@@ -58,7 +59,7 @@ public partial class AtmosphereSystem
/// <param name="mapGrid">The grid in question.</param>
/// <param name="tiles">The amount of tiles.</param>
/// <returns>The volume in liters that the tiles occupy.</returns>
private float GetVolumeForTiles(IMapGrid mapGrid, int tiles = 1)
private float GetVolumeForTiles(MapGridComponent mapGrid, int tiles = 1)
{
return Atmospherics.CellVolume * mapGrid.TileSize * tiles;
}
@@ -69,7 +70,7 @@ public partial class AtmosphereSystem
/// <param name="mapGrid">The grid where to get the tile.</param>
/// <param name="tile">The indices of the tile.</param>
/// <returns>The enumerator for the airtight components.</returns>
public AtmosObstructionEnumerator GetObstructingComponentsEnumerator(IMapGrid mapGrid, Vector2i tile)
public AtmosObstructionEnumerator GetObstructingComponentsEnumerator(MapGridComponent mapGrid, Vector2i tile)
{
var ancEnumerator = mapGrid.GetAnchoredEntitiesEnumerator(tile);
var airQuery = GetEntityQuery<AirtightComponent>();
@@ -78,7 +79,7 @@ public partial class AtmosphereSystem
return enumerator;
}
private AtmosDirection GetBlockedDirections(IMapGrid mapGrid, Vector2i indices)
private AtmosDirection GetBlockedDirections(MapGridComponent mapGrid, Vector2i indices)
{
var value = AtmosDirection.Invalid;
@@ -98,7 +99,7 @@ public partial class AtmosphereSystem
/// </summary>
/// <param name="mapGrid">The grid in question.</param>
/// <param name="tile">The indices of the tile.</param>
private void PryTile(IMapGrid mapGrid, Vector2i tile)
private void PryTile(MapGridComponent mapGrid, Vector2i tile)
{
if (!mapGrid.TryGetTileRef(tile, out var tileRef))
return;

View File

@@ -22,6 +22,7 @@ using Robust.Server.Maps;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
@@ -405,7 +406,7 @@ public sealed partial class CargoSystem
var offset = 0f;
if (TryComp<MapGridComponent>(orderDatabase.Shuttle, out var shuttleGrid))
{
var bounds = shuttleGrid.Grid.LocalAABB;
var bounds = shuttleGrid.LocalAABB;
offset = MathF.Max(bounds.Width, bounds.Height) / 2f;
}

View File

@@ -6,6 +6,7 @@ using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -73,8 +74,7 @@ namespace Content.Server.Chemistry.Components
if (!_entities.TryGetComponent(xform.GridUid, out MapGridComponent? gridComp))
return;
var grid = gridComp.Grid;
var origin = grid.TileIndicesFor(xform.Coordinates);
var origin = gridComp.TileIndicesFor(xform.Coordinates);
DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
@@ -82,10 +82,10 @@ namespace Content.Server.Chemistry.Components
{
// Currently no support for spreading off or across grids.
var index = origin + dir.ToIntVec();
if (!grid.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
if (!gridComp.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
return;
foreach (var neighbor in grid.GetAnchoredEntities(index))
foreach (var neighbor in gridComp.GetAnchoredEntities(index))
{
if (_entities.TryGetComponent(neighbor,
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
@@ -100,7 +100,7 @@ namespace Content.Server.Chemistry.Components
var newEffect = _entities.SpawnEntity(
meta.EntityPrototype.ID,
grid.GridTileToLocal(index));
gridComp.GridTileToLocal(index));
if (!_entities.TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent))
{

View File

@@ -9,6 +9,7 @@ using Content.Shared.Throwing;
using Content.Shared.Vapor;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
@@ -109,7 +110,7 @@ namespace Content.Server.Chemistry.EntitySystems
{
vapor.ReactTimer = 0;
var tile = gridComp.Grid.GetTileRef(xform.Coordinates.ToVector2i(EntityManager, _mapManager));
var tile = gridComp.GetTileRef(xform.Coordinates.ToVector2i(EntityManager, _mapManager));
foreach (var reagentQuantity in contents.Contents.ToArray())
{
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Coordinates.Helpers
{
@@ -26,7 +27,7 @@ namespace Content.Server.Coordinates.Helpers
return new EntityCoordinates(coordinates.EntityId, x, y);
}
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IMapGrid grid)
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, MapGridComponent grid)
{
var tileSize = grid.TileSize;

View File

@@ -26,6 +26,7 @@ using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
using Robust.Shared.Random;
@@ -515,7 +516,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
return false;
var coords = xform.Coordinates;
var entry = grid.Grid.GetLocal(coords)
var entry = grid.GetLocal(coords)
.FirstOrDefault(entity => EntityManager.HasComponent<DisposalEntryComponent>(entity));
if (entry == default)

View File

@@ -13,6 +13,7 @@ using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
using Microsoft.Extensions.Options;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
namespace Content.Server.Doors.Systems
@@ -233,7 +234,7 @@ namespace Content.Server.Doors.Systems
if (!TryComp(xform.ParentUid, out GridAtmosphereComponent? gridAtmosphere))
return (false, false);
var grid = Comp<MapGridComponent>(xform.ParentUid).Grid;
var grid = Comp<MapGridComponent>(xform.ParentUid);
var pos = grid.CoordinatesToTile(xform.Coordinates);
var minPressure = float.MaxValue;
var maxPressure = float.MinValue;

View File

@@ -3,6 +3,7 @@ using Content.Server.GameTicking;
using Content.Server.StationEvents.Components;
using Content.Shared.Dragon;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
namespace Content.Server.Dragon;

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Electrocution
{
@@ -15,7 +16,7 @@ namespace Content.Server.Electrocution
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!nodeQuery.TryGetComponent(CableEntity, out var nodeContainer))

View File

@@ -1,5 +1,6 @@
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using static Content.Server.Explosion.EntitySystems.ExplosionSystem;
namespace Content.Server.Explosion.EntitySystems;
@@ -9,7 +10,7 @@ namespace Content.Server.Explosion.EntitySystems;
/// </summary>
public sealed class ExplosionGridTileFlood : ExplosionTileFlood
{
public IMapGrid Grid;
public MapGridComponent Grid;
private bool _needToTransform = false;
private Matrix3 _matrix = Matrix3.Identity;
@@ -35,7 +36,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
private Dictionary<Vector2i, NeighborFlag> _edgeTiles;
public ExplosionGridTileFlood(
IMapGrid grid,
MapGridComponent grid,
Dictionary<Vector2i, TileData> airtightMap,
float maxIntensity,
float intensityStepSize,
@@ -179,7 +180,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
if (EnteredBlockedTiles.Contains(tile))
return;
// Did the explosion already attempt to enter this tile from some other direction?
// Did the explosion already attempt to enter this tile from some other direction?
if (!UnenteredBlockedTiles.Add(tile))
return;
@@ -203,7 +204,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
if (!EnteredBlockedTiles.Add(tile))
return;
// Did the explosion already attempt to enter this tile from some other direction?
// Did the explosion already attempt to enter this tile from some other direction?
if (UnenteredBlockedTiles.Contains(tile))
{
NewFreedTiles.Add(tile);

View File

@@ -5,6 +5,7 @@ using Content.Shared.Damage;
using Content.Shared.Explosion;
using Content.Shared.FixedPoint;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Explosion.EntitySystems;
@@ -57,7 +58,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// something like a normal and a reinforced windoor on the same tile. But given that this is a pretty rare
/// occurrence, I am fine with this.
/// </remarks>
public void UpdateAirtightMap(IMapGrid grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
public void UpdateAirtightMap(MapGridComponent grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
{
var tolerance = new float[_explosionTypes.Count];
var blockedDirections = AtmosDirection.Invalid;

View File

@@ -1,5 +1,7 @@
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Explosion.EntitySystems;
// This partial part of the explosion system has all of the functions used to facilitate explosions moving across grids.
@@ -289,7 +291,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// Optionally ignore a specific Vector2i. Used by <see cref="OnTileChanged"/> when we already know that a
/// given tile is not space. This avoids unnecessary TryGetTileRef calls.
/// </remarks>
private bool IsEdge(IMapGrid grid, Vector2i index, out NeighborFlag spaceDirections)
private bool IsEdge(MapGridComponent grid, Vector2i index, out NeighborFlag spaceDirections)
{
spaceDirections = NeighborFlag.Invalid;
for (var i = 0; i < NeighbourVectors.Length; i++)

View File

@@ -4,6 +4,7 @@ using Content.Shared.Explosion;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
@@ -194,7 +195,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// </summary>
/// <returns>True if the underlying tile can be uprooted, false if the tile is blocked by a dense entity</returns>
internal bool ExplodeTile(BroadphaseComponent lookup,
IMapGrid grid,
MapGridComponent grid,
Vector2i tile,
float throwForce,
DamageSpecifier damage,
@@ -494,7 +495,7 @@ sealed class Explosion
/// <summary>
/// The actual grid that this corresponds to. If null, this implies space.
/// </summary>
public IMapGrid? MapGrid;
public MapGridComponent? MapGrid;
}
private readonly List<ExplosionData> _explosionData = new();
@@ -543,7 +544,7 @@ sealed class Explosion
// Variables used for enumerating over tiles, grids, etc
private DamageSpecifier _currentDamage = default!;
private BroadphaseComponent _currentLookup = default!;
private IMapGrid? _currentGrid;
private MapGridComponent? _currentGrid;
private float _currentIntensity;
private float _currentThrowForce;
private List<Vector2i>.Enumerator _currentEnumerator;
@@ -553,7 +554,7 @@ sealed class Explosion
/// The set of tiles that need to be updated when the explosion has finished processing. Used to avoid having
/// the explosion trigger chunk regeneration & shuttle-system processing every tick.
/// </summary>
private readonly Dictionary<IMapGrid, List<(Vector2i, Tile)>> _tileUpdateDict = new();
private readonly Dictionary<MapGridComponent, List<(Vector2i, Tile)>> _tileUpdateDict = new();
// Entity Queries
private readonly EntityQuery<TransformComponent> _xformQuery;
@@ -642,7 +643,7 @@ sealed class Explosion
_explosionData.Add(new()
{
TileLists = grid.TileLists,
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.GridEntityId),
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.Owner),
MapGrid = grid.Grid
});
}

View File

@@ -319,7 +319,7 @@ public sealed partial class ExplosionSystem : EntitySystem
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
foreach (var grid in gridData)
{
tileLists.Add(grid.Grid.GridEntityId, grid.TileLists);
tileLists.Add(grid.Grid.Owner, grid.TileLists);
}
return new ExplosionEvent(_explosionCounter, epicenter, id, iterationIntensity, spaceTiles, tileLists, spaceMatrix, spaceData?.TileSize ?? DefaultTileSize);

View File

@@ -6,6 +6,9 @@ using Content.Shared.Directions;
using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Utility;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
@@ -101,7 +104,7 @@ public sealed class FluidSpreaderSystem : EntitySystem
/// <param name="mapGrid">helper param needed to extract entities</param>
/// <param name="puddle">either found or newly created PuddleComponent.</param>
/// <returns>true if tile is empty or occupied by a non-overflowing puddle (or a puddle close to being overflowing)</returns>
private bool CheckTile(EntityUid srcUid, PuddleComponent srcPuddle, EntityCoordinates pos, IMapGrid mapGrid,
private bool CheckTile(EntityUid srcUid, PuddleComponent srcPuddle, EntityCoordinates pos, MapGridComponent mapGrid,
[NotNullWhen(true)] out PuddleComponent? puddle)
{
if (!mapGrid.TryGetTileRef(pos, out var tileRef)

View File

@@ -153,7 +153,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem
var xformQuery = GetEntityQuery<TransformComponent>();
var aabbs = _stationSystem.Stations.SelectMany(x =>
Comp<StationDataComponent>(x).Grids.Select(x => xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).Grid.LocalAABB))).ToArray();
Comp<StationDataComponent>(x).Grids.Select(x => xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB))).ToArray();
var aabb = aabbs[0];

View File

@@ -22,6 +22,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -215,7 +216,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
foreach (var (_, mapGrid) in EntityManager.EntityQuery<StationMemberComponent, MapGridComponent>(true))
{
// I'm so sorry.
var tiles = mapGrid.Grid.GetAllTiles().ToArray();
var tiles = mapGrid.GetAllTiles().ToArray();
Logger.Info($"TILES: {tiles.Length}");
var spawn = susLoot.GetSpawns();

View File

@@ -10,6 +10,7 @@ using Content.Shared.Physics;
using Microsoft.Extensions.ObjectPool;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
@@ -140,7 +141,7 @@ public sealed partial class PathfindingSystem
var fixturesQuery = GetEntityQuery<FixturesComponent>();
var physicsQuery = GetEntityQuery<PhysicsComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
BuildBreadcrumbs(dirt[i], mapGridComp, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
}
const int Division = 4;
@@ -361,7 +362,7 @@ public sealed partial class PathfindingSystem
}
private void BuildBreadcrumbs(GridPathfindingChunk chunk,
IMapGrid grid,
MapGridComponent grid,
EntityQuery<AccessReaderComponent> accessQuery,
EntityQuery<DestructibleComponent> destructibleQuery,
EntityQuery<DoorComponent> doorQuery,

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.NodeContainer.Nodes
{
@@ -11,7 +12,7 @@ namespace Content.Server.NodeContainer.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.NodeContainer.Nodes
{
@@ -97,7 +98,7 @@ namespace Content.Server.NodeContainer.Nodes
public abstract IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan);
}
}

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.NodeContainer.Nodes
{
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
public static class NodeHelpers
{
public static IEnumerable<Node> GetNodesInTile(EntityQuery<NodeContainerComponent> nodeQuery, IMapGrid grid, Vector2i coords)
public static IEnumerable<Node> GetNodesInTile(EntityQuery<NodeContainerComponent> nodeQuery, MapGridComponent grid, Vector2i coords)
{
foreach (var entityUid in grid.GetAnchoredEntities(coords))
{
@@ -24,7 +25,7 @@ namespace Content.Server.NodeContainer.Nodes
public static IEnumerable<(Direction dir, Node node)> GetCardinalNeighborNodes(
EntityQuery<NodeContainerComponent> nodeQuery,
IMapGrid grid,
MapGridComponent grid,
Vector2i coords,
bool includeSameTile = true)
{
@@ -42,7 +43,7 @@ namespace Content.Server.NodeContainer.Nodes
[SuppressMessage("ReSharper", "EnforceForeachStatementBraces")]
public static IEnumerable<(Direction dir, EntityUid entity)> GetCardinalNeighborCells(
IMapGrid grid,
MapGridComponent grid,
Vector2i coords,
bool includeSameTile = true)
{

View File

@@ -3,6 +3,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
namespace Content.Server.NodeContainer.Nodes
@@ -152,7 +153,7 @@ namespace Content.Server.NodeContainer.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (_alwaysReachable != null)
@@ -195,7 +196,7 @@ namespace Content.Server.NodeContainer.Nodes
/// <summary>
/// Gets the pipes that can connect to us from entities on the tile or adjacent in a direction.
/// </summary>
private IEnumerable<PipeNode> LinkableNodesInDirection(Vector2i pos, PipeDirection pipeDir, IMapGrid grid,
private IEnumerable<PipeNode> LinkableNodesInDirection(Vector2i pos, PipeDirection pipeDir, MapGridComponent grid,
EntityQuery<NodeContainerComponent> nodeQuery)
{
foreach (var pipe in PipesInDirection(pos, pipeDir, grid, nodeQuery))
@@ -211,7 +212,7 @@ namespace Content.Server.NodeContainer.Nodes
/// <summary>
/// Gets the pipes from entities on the tile adjacent in a direction.
/// </summary>
protected IEnumerable<PipeNode> PipesInDirection(Vector2i pos, PipeDirection pipeDir, IMapGrid grid,
protected IEnumerable<PipeNode> PipesInDirection(Vector2i pos, PipeDirection pipeDir, MapGridComponent grid,
EntityQuery<NodeContainerComponent> nodeQuery)
{
var offsetPos = pos.Offset(pipeDir.ToDirection());

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.NodeContainer.Nodes
{
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.NodeContainer.Nodes
{
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -2,6 +2,7 @@ using Content.Server.Cuffs.Components;
using Content.Server.Objectives.Interfaces;
using Content.Server.Station.Components;
using JetBrains.Annotations;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
namespace Content.Server.Objectives.Conditions
@@ -38,7 +39,7 @@ namespace Content.Server.Objectives.Conditions
return false;
}
return shuttleXform.WorldMatrix.TransformBox(shuttleGrid.Grid.LocalAABB).Contains(agentXform.WorldPosition);
return shuttleXform.WorldMatrix.TransformBox(shuttleGrid.LocalAABB).Contains(agentXform.WorldPosition);
}
public float Progress

View File

@@ -12,6 +12,7 @@ using Content.Shared.Singularity.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
// using static Content.Shared.Wires.SharedWiresComponent;
using Timer = Robust.Shared.Timing.Timer;
@@ -344,7 +345,7 @@ namespace Content.Server.ParticleAccelerator.Components
// Find fuel chamber first by scanning cardinals.
if (xform.Anchored && _entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid))
{
foreach (var maybeFuel in grid.Grid.GetCardinalNeighborCells(xform.Coordinates))
foreach (var maybeFuel in grid.GetCardinalNeighborCells(xform.Coordinates))
{
if (_entMan.TryGetComponent(maybeFuel, out _partFuelChamber))
{

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Power.Nodes
{
@@ -14,7 +15,7 @@ namespace Content.Server.Power.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Power.Nodes
{
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Power.Nodes
{
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -1,6 +1,7 @@
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Power.Nodes
{
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
EntityQuery<NodeContainerComponent> nodeQuery,
EntityQuery<TransformComponent> xformQuery,
IMapGrid? grid,
MapGridComponent? grid,
IEntityManager entMan)
{
if (!xform.Anchored || grid == null)

View File

@@ -11,6 +11,7 @@ using Content.Shared.Maps;
using Content.Shared.Tag;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
namespace Content.Server.RCD.Systems
@@ -155,7 +156,7 @@ namespace Content.Server.RCD.Systems
args.Handled = true;
}
private bool IsRCDStillValid(RCDComponent rcd, AfterInteractEvent eventArgs, IMapGrid mapGrid, TileRef tile, RcdMode startingMode)
private bool IsRCDStillValid(RCDComponent rcd, AfterInteractEvent eventArgs, MapGridComponent mapGrid, TileRef tile, RcdMode startingMode)
{
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
if (rcd.CurrentAmmo <= 0)

View File

@@ -1,6 +1,7 @@
using Content.Server.Radiation.Components;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
using Robust.Shared.Map.Components;
namespace Content.Server.Radiation.Systems;
@@ -107,7 +108,7 @@ public partial class RadiationSystem
// save resistance into rad protection grid
var gridId = trs.GridUid.Value;
var tilePos = grid.Grid.TileIndicesFor(trs.Coordinates);
var tilePos = grid.TileIndicesFor(trs.Coordinates);
AddToTile(gridId, tilePos, component.RadResistance);
// and remember it as last valid position

View File

@@ -3,6 +3,7 @@ using Content.Shared.Radiation.Components;
using Content.Shared.Radiation.Systems;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -118,7 +119,7 @@ public partial class RadiationSystem
{
if (!gridQuery.TryGetComponent(sourceTrs.GridUid.Value, out var gridComponent))
return ray;
return Gridcast(gridComponent.Grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value));
return Gridcast(gridComponent, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value));
}
// lets check how many grids are between source and destination
@@ -142,7 +143,7 @@ public partial class RadiationSystem
return ray;
}
private RadiationRay Gridcast(IMapGrid grid, RadiationRay ray, bool saveVisitedTiles,
private RadiationRay Gridcast(MapGridComponent grid, RadiationRay ray, bool saveVisitedTiles,
EntityQuery<RadiationGridResistanceComponent> resistanceQuery,
TransformComponent sourceTrs,
TransformComponent destTrs,

View File

@@ -17,6 +17,7 @@ using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
@@ -115,7 +116,7 @@ public sealed partial class ShuttleSystem
/// </summary>
private bool ValidSpawn(MapGridComponent grid, Box2 area)
{
return !grid.Grid.GetLocalTilesIntersecting(area).Any();
return !grid.GetLocalTilesIntersecting(area).Any();
}
private DockingConfig? GetDockingConfig(ShuttleComponent component, EntityUid targetGrid)
@@ -131,7 +132,7 @@ public sealed partial class ShuttleSystem
var targetGridRotation = targetGridAngle.ToVec();
var shuttleDocks = GetDocks(component.Owner);
var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
var shuttleAABB = Comp<MapGridComponent>(component.Owner).LocalAABB;
var validDockConfigs = new List<DockingConfig>();

View File

@@ -15,6 +15,7 @@ using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
namespace Content.Server.Shuttles.Systems;
@@ -95,7 +96,7 @@ public sealed partial class ShuttleSystem
return true;
}
var bounds = xform.WorldMatrix.TransformBox(grid.Grid.LocalAABB).Enlarged(ShuttleFTLRange);
var bounds = xform.WorldMatrix.TransformBox(grid.LocalAABB).Enlarged(ShuttleFTLRange);
var bodyQuery = GetEntityQuery<PhysicsComponent>();
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
@@ -226,7 +227,7 @@ public sealed partial class ShuttleSystem
comp.State = FTLState.Travelling;
var width = Comp<MapGridComponent>(comp.Owner).Grid.LocalAABB.Width;
var width = Comp<MapGridComponent>(comp.Owner).LocalAABB.Width;
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
xform.LocalRotation = Angle.Zero;
_index += width + Buffer;
@@ -458,13 +459,13 @@ public sealed partial class ShuttleSystem
}
var xformQuery = GetEntityQuery<TransformComponent>();
var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
var shuttleAABB = Comp<MapGridComponent>(component.Owner).LocalAABB;
// Spawn nearby.
// We essentially expand the Box2 of the target area until nothing else is added then we know it's valid.
// Can't just get an AABB of every grid as we may spawn very far away.
var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery)
.TransformBox(Comp<MapGridComponent>(targetUid).Grid.LocalAABB).Enlarged(shuttleAABB.Size.Length);
.TransformBox(Comp<MapGridComponent>(targetUid).LocalAABB).Enlarged(shuttleAABB.Size.Length);
var nearbyGrids = new HashSet<EntityUid>(1) { targetUid };
var iteration = 0;
@@ -478,7 +479,7 @@ public sealed partial class ShuttleSystem
if (!nearbyGrids.Add(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
}
// Can do proximity
@@ -501,7 +502,7 @@ public sealed partial class ShuttleSystem
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
}
break;

View File

@@ -6,6 +6,7 @@ using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;

View File

@@ -7,6 +7,7 @@ using JetBrains.Annotations;
using Robust.Server.GameStates;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;

View File

@@ -10,6 +10,7 @@ using Robust.Shared.Collections;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Random;
@@ -243,10 +244,10 @@ public sealed class StationSystem : EntitySystem
foreach (var gridUid in component.Grids)
{
if (!TryComp<MapGridComponent>(gridUid, out var grid) ||
grid.Grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
continue;
largestBounds = grid.Grid.LocalAABB;
largestBounds = grid.LocalAABB;
largestGrid = gridUid;
}

View File

@@ -9,6 +9,7 @@ using Content.Server.Station.Systems;
using Content.Shared.Database;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -148,11 +149,9 @@ namespace Content.Server.StationEvents.Events
if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
return false;
var grid = gridComp.Grid;
var found = false;
var (gridPos, _, gridMatrix) = Transform(targetGrid).GetWorldPositionRotationMatrix();
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
var gridBounds = gridMatrix.TransformBox(gridComp.LocalAABB);
for (var i = 0; i < 10; i++)
{
@@ -160,15 +159,15 @@ namespace Content.Server.StationEvents.Events
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
if (_atmosphere.IsTileSpace(grid.GridEntityId, Transform(targetGrid).MapUid, tile,
if (_atmosphere.IsTileSpace(gridComp.GridEntityId, Transform(targetGrid).MapUid, tile,
mapGridComp: gridComp)
|| _atmosphere.IsTileAirBlocked(grid.GridEntityId, tile, mapGridComp: gridComp))
|| _atmosphere.IsTileAirBlocked(gridComp.GridEntityId, tile, mapGridComp: gridComp))
{
continue;
}
found = true;
targetCoords = grid.GridTileToLocal(tile);
targetCoords = gridComp.GridTileToLocal(tile);
break;
}

View File

@@ -1,5 +1,6 @@
using Content.Shared.GameTicking;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Tabletop
{

View File

@@ -5,6 +5,7 @@ using Content.Shared.Maps;
using Content.Shared.Physics;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
@@ -94,7 +95,7 @@ namespace Content.Server.Tiles
return false;
}
private void PlaceAt(IMapGrid mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
private void PlaceAt(MapGridComponent mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
{
var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants);
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Shared.Coordinates
{
@@ -19,17 +20,17 @@ namespace Content.Shared.Coordinates
return new EntityCoordinates(id, x, y);
}
public static EntityCoordinates ToCoordinates(this IMapGrid grid, Vector2 offset)
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, Vector2 offset)
{
return ToCoordinates(grid.GridEntityId, offset);
}
public static EntityCoordinates ToCoordinates(this IMapGrid grid, float x, float y)
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, float x, float y)
{
return ToCoordinates(grid.GridEntityId, x, y);
}
public static EntityCoordinates ToCoordinates(this IMapGrid grid)
public static EntityCoordinates ToCoordinates(this MapGridComponent grid)
{
return ToCoordinates(grid.GridEntityId, Vector2.Zero);
}

View File

@@ -2,6 +2,7 @@ using Content.Shared.Ghost;
using Content.Shared.Radiation;
using Content.Shared.Radiation.Components;
using Content.Shared.Singularity.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components;

View File

@@ -3,6 +3,7 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Serialization;
namespace Content.Shared.SubFloor
@@ -107,14 +108,14 @@ namespace Content.Shared.SubFloor
UpdateAppearance(uid, component);
}
public bool HasFloorCover(IMapGrid grid, Vector2i position)
public bool HasFloorCover(MapGridComponent grid, Vector2i position)
{
// TODO Redo this function. Currently wires on an asteroid are always "below the floor"
var tileDef = (ContentTileDefinition) _tileDefinitionManager[grid.GetTileRef(position).Tile.TypeId];
return !tileDef.IsSubFloor;
}
private void UpdateTile(IMapGrid grid, Vector2i position)
private void UpdateTile(MapGridComponent grid, Vector2i position)
{
var covered = HasFloorCover(grid, position);

View File

@@ -33,7 +33,7 @@
density: 100
hard: true
id: projectile
# Didn't use MapGrid for now as the bounds are stuffed.
# Didn't use MapGridComponent for now as the bounds are stuffed.
layer:
- LargeMobLayer
mask: