From cc08eb883ba095be10faec3a503731139673677a Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 00:44:03 -0700 Subject: [PATCH 01/21] Move MapManager queries to SharedMapSystem Moves all variants of FindGridsIntersecting/TryFindGridAt to SharedMapSystem Hollows out the MapManager methods and converts them into relays to SharedMapSystem --- .../Systems/SharedMapSystem.Lookup.cs | 452 ++++++++++++++++++ .../GameObjects/Systems/SharedMapSystem.cs | 3 + Robust.Shared/Map/IMapManager.cs | 21 + Robust.Shared/Map/MapManager.Queries.cs | 262 ++-------- 4 files changed, 522 insertions(+), 216 deletions(-) create mode 100644 Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs new file mode 100644 index 00000000000..00af546bdfd --- /dev/null +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs @@ -0,0 +1,452 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Numerics; +using Robust.Shared.Map; +using Robust.Shared.Map.Components; +using Robust.Shared.Map.Enumerators; +using Robust.Shared.Maths; +using Robust.Shared.Physics; +using Robust.Shared.Physics.Collision.Shapes; +using Robust.Shared.Physics.Shapes; +using Transform = Robust.Shared.Physics.Transform; + +namespace Robust.Shared.GameObjects; + +public abstract partial class SharedMapSystem +{ + #region TryFindGridAt + + public bool TryFindGridAt(EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) + { + var rangeVec = new Vector2(0.2f, 0.2f); + + // Need to enlarge the AABB by at least the grid shrinkage size. + var aabb = new Box2(worldPos - rangeVec, worldPos + rangeVec); + + uid = EntityUid.Invalid; + grid = null; + var state = (uid, grid, worldPos, this, _transform); + + FindGridsIntersecting(mapEnt, aabb, ref state, static (EntityUid iUid, MapGridComponent iGrid, ref ( + EntityUid uid, + MapGridComponent? grid, + Vector2 worldPos, + SharedMapSystem mapSystem, + SharedTransformSystem xformSystem) tuple) => + { + // Turn the worldPos into a localPos and work out the relevant chunk we need to check + // This is much faster than iterating over every chunk individually. + // (though now we need some extra calcs up front). + + // Doesn't use WorldBounds because it's just an AABB. + var matrix = tuple.xformSystem.GetInvWorldMatrix(iUid); + var localPos = Vector2.Transform(tuple.worldPos, matrix); + + // NOTE: + // If you change this to use fixtures instead (i.e. if you want half-tiles) then you need to make sure + // you account for the fact that fixtures are shrunk slightly! + var chunkIndices = SharedMapSystem.GetChunkIndices(localPos, iGrid.ChunkSize); + + if (!iGrid.Chunks.TryGetValue(chunkIndices, out var chunk)) + return true; + + var chunkRelative = SharedMapSystem.GetChunkRelative(localPos, iGrid.ChunkSize); + var chunkTile = chunk.GetTile(chunkRelative); + + if (chunkTile.IsEmpty) + return true; + + tuple.uid = iUid; + tuple.grid = iGrid; + return false; + }, approx: true, includeMap: false); + + if (state.grid == null && _gridQuery.TryGetComponent(mapEnt, out var mapGrid)) + { + uid = mapEnt; + grid = mapGrid; + return true; + } + + uid = state.uid; + grid = state.grid; + return grid != null; + } + + public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) + { + if (TryGetMap(mapId, out var map)) + return TryFindGridAt(map.Value, worldPos, out uid, out grid); + + uid = default; + grid = null; + return false; + } + + public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) + { + return TryFindGridAt(mapCoordinates.MapId, mapCoordinates.Position, out uid, out grid); + } + + #endregion + + #region MapId + + public void FindGridsIntersecting( + MapId mapId, + T shape, + Transform transform, + ref List> grids, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) where T : IPhysShape + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, shape, transform, ref grids, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + T shape, + Transform transform, + GridCallback callback, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) where T : IPhysShape + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, shape, transform, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2 worldAABB, + GridCallback callback, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, worldAABB, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2 worldAABB, + ref TState state, + GridCallback callback, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var map)) + FindGridsIntersecting(map.Value, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2 worldAABB, + ref List> grids, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var map)) + FindGridsIntersecting(map.Value, worldAABB, ref grids, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2Rotated worldBounds, + GridCallback callback, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, worldBounds, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2Rotated worldBounds, + ref TState state, + GridCallback callback, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + MapId mapId, + Box2Rotated worldBounds, + ref List> grids, + bool approx = IMapManager.Approximate, + bool includeMap = IMapManager.IncludeMap) + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, worldBounds, ref grids, approx: approx, includeMap: includeMap); + } + + #endregion + + #region EntityUid + + public void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Transform transform, + GridCallback callback, + bool approx = false, + bool includeMap = true) where TShape : IPhysShape + { + FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Transform transform, + ref TState state, + GridCallback callback, + bool approx = false, + bool includeMap = true) where TShape : IPhysShape + { + FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref state, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + List shapes, + Transform transform, + ref List> entities, + bool approx = false, + bool includeMap = true) + { + foreach (var shape in shapes) + { + FindGridsIntersecting(mapEnt, shape, transform, ref entities, approx: approx, includeMap: includeMap); + } + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Transform transform, + ref List> grids, + bool approx = false, + bool includeMap = true) where TShape : IPhysShape + { + FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref grids, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2 worldAABB, + GridCallback callback, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldAABB); + FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2 worldAABB, + ref TState state, + GridCallback callback, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldAABB); + FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2 worldAABB, + ref List> grids, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldAABB); + FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref grids, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2Rotated worldBounds, + GridCallback callback, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldBounds); + FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2Rotated worldBounds, + ref TState state, + GridCallback callback, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldBounds); + FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + Box2Rotated worldBounds, + ref List> grids, + bool approx = false, + bool includeMap = true) + { + var shape = new SlimPolygon(worldBounds); + FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, ref grids, approx: approx, includeMap: includeMap); + } + + #endregion + + public IEnumerable> GetAllGrids(MapId mapId) + { + throw new System.NotImplementedException(); + } + + public IEnumerable GetAllMapGrids(MapId mapId) + { + throw new System.NotImplementedException(); + } + + public void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Box2 worldAABB, + Transform transform, + ref List> grids, + bool approx, + bool includeMap) where TShape : IPhysShape + { + var state = grids; + FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref state, + static (EntityUid uid, MapGridComponent grid, ref List> state) => + { + state.Add((uid, grid)); + return true; + }, + approx, includeMap + ); + } + + private void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Box2 worldAABB, + Transform transform, + GridCallback callback, + bool approx, + bool includeMap) where TShape : IPhysShape + { + var state = callback; + FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref state, + static (EntityUid uid, MapGridComponent grid, ref GridCallback state) => state.Invoke(uid, grid), + approx, includeMap + ); + } + + private void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Box2 worldAABB, + Transform transform, + ref TState state, + GridCallback callback, + bool approx, + bool includeMap) where TShape : IPhysShape + { + if (!_gridTreeQuery.TryGetComponent(mapEnt, out var gridTree)) + return; + + if (includeMap && _gridQuery.TryGetComponent(mapEnt, out var mapGrid)) + { + callback(mapEnt, mapGrid, ref state); + } + + var gridState = new GridQueryState( + callback, + state, + worldAABB, + shape, + transform, + gridTree.Tree, + this, + _transform, + approx); + + gridTree.Tree.Query(ref gridState, static (ref GridQueryState state, DynamicTree.Proxy proxy) => + { + // Even for approximate we'll check if any chunks roughly overlap. + var data = state.Tree.GetUserData(proxy); + var gridInvMatrix = state.TransformSystem.GetInvWorldMatrix(data.Uid); + var localAABB = gridInvMatrix.TransformBox(state.WorldAABB); + + var overlappingChunks = state.MapSystem.GetLocalMapChunks(data.Uid, data.Grid, localAABB); + + if (state.Approximate) + { + if (!overlappingChunks.MoveNext(out _)) + return true; + } + else if (!state.MapSystem.IsIntersecting(overlappingChunks, state.Shape, state.Transform, (data.Uid, data.Fixtures))) + { + return true; + } + + var callbackState = state.State; + var result = state.Callback(data.Uid, data.Grid, ref callbackState); + state.State = callbackState; + + return result; + }, worldAABB); + + // By-ref things + state = gridState.State; + } + + private bool IsIntersecting( + ChunkEnumerator enumerator, + TShape shape, + Transform shapeTransform, + Entity grid) where TShape : IPhysShape + { + var gridTransform = _physics.GetPhysicsTransform(grid); + + while (enumerator.MoveNext(out var chunk)) + { + foreach (var id in chunk.Fixtures) + { + var fixture = grid.Comp.Fixtures[id]; + + for (var j = 0; j < fixture.Shape.ChildCount; j++) + { + if (_manifolds.TestOverlap(shape, 0, fixture.Shape, j, shapeTransform, gridTransform)) + { + return true; + } + } + } + } + + return false; + } + + private record struct GridQueryState( + GridCallback Callback, + TState State, + Box2 WorldAABB, + TShape Shape, + Transform Transform, + B2DynamicTree<(EntityUid Uid, FixturesComponent Fixtures, MapGridComponent Grid)> Tree, + SharedMapSystem MapSystem, + SharedTransformSystem TransformSystem, + bool Approximate + ) where TShape : IPhysShape; +} diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs index 2f99eb9c7ae..16e07f3d50f 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs @@ -8,6 +8,7 @@ using Robust.Shared.Maths; using Robust.Shared.Network; using Robust.Shared.Physics; +using Robust.Shared.Physics.Collision; using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -22,6 +23,7 @@ public abstract partial class SharedMapSystem : EntitySystem [Dependency] private ITileDefinitionManager _tileMan = default!; [Dependency] private IGameTiming _timing = default!; [Dependency] protected IMapManager MapManager = default!; + [Dependency] private IManifoldManager _manifolds = default!; [Dependency] private IMapManagerInternal _mapInternal = default!; [Dependency] private INetManager _netManager = default!; [Dependency] private FixtureSystem _fixtures = default!; @@ -34,6 +36,7 @@ public abstract partial class SharedMapSystem : EntitySystem private EntityQuery _gridQuery; private EntityQuery _metaQuery; private EntityQuery _xformQuery; + [Dependency] EntityQuery _gridTreeQuery; internal Dictionary Maps { get; } = new(); diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs index d0aaea4a5a4..8855d2366fd 100644 --- a/Robust.Shared/Map/IMapManager.cs +++ b/Robust.Shared/Map/IMapManager.cs @@ -82,29 +82,37 @@ public interface IMapManager #region MapId + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap); @@ -112,38 +120,48 @@ public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List #region MapEnt + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; /// /// Returns true if any grids overlap the specified shapes. /// + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, List shapes, Transform transform, ref List> entities, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); + [Obsolete("Use MapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap); @@ -152,6 +170,7 @@ public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, #region TryFindGridAt + [Obsolete("Use MapSystem")] public bool TryFindGridAt( EntityUid mapEnt, Vector2 worldPos, @@ -161,12 +180,14 @@ public bool TryFindGridAt( /// /// Attempts to find the map grid under the map location. /// + [Obsolete("Use MapSystem")] public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid); /// /// Attempts to find the map grid under the map location. /// + [Obsolete("Use MapSystem")] public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid); diff --git a/Robust.Shared/Map/MapManager.Queries.cs b/Robust.Shared/Map/MapManager.Queries.cs index f37a545525f..0799927e63f 100644 --- a/Robust.Shared/Map/MapManager.Queries.cs +++ b/Robust.Shared/Map/MapManager.Queries.cs @@ -4,102 +4,74 @@ using System.Numerics; using Robust.Shared.GameObjects; using Robust.Shared.Map.Components; -using Robust.Shared.Map.Enumerators; using Robust.Shared.Maths; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; -using Robust.Shared.Physics.Shapes; namespace Robust.Shared.Map; internal partial class MapManager { - private bool IsIntersecting( - ChunkEnumerator enumerator, - T shape, - Transform shapeTransform, - Entity grid) where T : IPhysShape - { - var gridTransform = _physics.GetPhysicsTransform(grid); - - while (enumerator.MoveNext(out var chunk)) - { - foreach (var id in chunk.Fixtures) - { - var fixture = grid.Comp.Fixtures[id]; - - for (var j = 0; j < fixture.Shape.ChildCount; j++) - { - if (_manifolds.TestOverlap(shape, 0, fixture.Shape, j, shapeTransform, gridTransform)) - { - return true; - } - } - } - } - - return false; - } - - #region MapId + #region MapId [Obsolete] + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, shape, transform, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, shape, transform, ref grids, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, shape, transform, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, shape, transform, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, worldAABB, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldAABB, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var map)) - FindGridsIntersecting(map.Value, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var map)) - FindGridsIntersecting(map.Value, worldAABB, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldAABB, ref grids, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, worldBounds, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldBounds, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - if (_mapSystem.TryGetMap(mapId, out var mapEnt)) - FindGridsIntersecting(mapEnt.Value, worldBounds, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapId, worldBounds, ref grids, approx: approx, includeMap: includeMap); } #endregion - #region MapEnt + #region MapEnt [Obsolete] + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting( EntityUid mapEnt, T shape, @@ -108,19 +80,10 @@ public void FindGridsIntersecting( bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, callback, approx: approx, includeMap: includeMap); - } - - private void FindGridsIntersecting(EntityUid mapEnt, T shape, Box2 worldAABB, Transform transform, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - // This is here so we don't double up on code. - var state = callback; - - FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref state, - static (EntityUid uid, MapGridComponent grid, ref GridCallback state) => state.Invoke(uid, grid), - approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting( EntityUid mapEnt, T shape, @@ -130,236 +93,103 @@ public void FindGridsIntersecting( bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref state, callback, approx: approx, includeMap: includeMap); - } - - private void FindGridsIntersecting( - EntityUid mapEnt, - T shape, - Box2 worldAABB, - Transform transform, - ref TState state, - GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - if (!_gridTreeQuery.TryGetComponent(mapEnt, out var gridTree)) - return; - - if (includeMap && _gridQuery.TryGetComponent(mapEnt, out var mapGrid)) - { - callback(mapEnt, mapGrid, ref state); - } - - var gridState = new GridQueryState( - callback, - state, - worldAABB, - shape, - transform, - gridTree.Tree, - _mapSystem, - this, - _transformSystem, - approx); - - gridTree.Tree.Query(ref gridState, static (ref GridQueryState state, DynamicTree.Proxy proxy) => - { - // Even for approximate we'll check if any chunks roughly overlap. - var data = state.Tree.GetUserData(proxy); - var gridInvMatrix = state.TransformSystem.GetInvWorldMatrix(data.Uid); - var localAABB = gridInvMatrix.TransformBox(state.WorldAABB); - - var overlappingChunks = state.MapSystem.GetLocalMapChunks(data.Uid, data.Grid, localAABB); - - if (state.Approximate) - { - if (!overlappingChunks.MoveNext(out _)) - return true; - } - else if (!state.MapManager.IsIntersecting(overlappingChunks, state.Shape, state.Transform, (data.Uid, data.Fixtures))) - { - return true; - } - - var callbackState = state.State; - var result = state.Callback(data.Uid, data.Grid, ref callbackState); - state.State = callbackState; - - return result; - }, worldAABB); - - // By-ref things - state = gridState.State; + _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref state, callback, approx: approx, includeMap: includeMap); } /// /// Returns true if any grids overlap the specified shapes. /// + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, List shapes, Transform transform, ref List> entities, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - foreach (var shape in shapes) - { - FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref entities, approx: approx, includeMap: includeMap); - } + _mapSystem.FindGridsIntersecting(mapEnt, shapes, transform, ref entities, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref grids, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Box2 worldAABB, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - var state = grids; - - FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref state, - static (EntityUid uid, MapGridComponent grid, ref List> list) => - { - list.Add((uid, grid)); - return true; - }, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref grids, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldAABB); - FindGridsIntersecting(mapEnt, polygon, worldAABB, Transform.Empty, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldAABB); - FindGridsIntersecting(mapEnt, polygon, worldAABB, Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldAABB); - FindGridsIntersecting(mapEnt, polygon, worldAABB, Transform.Empty, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref grids, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldBounds); - FindGridsIntersecting(mapEnt, polygon, worldBounds.CalcBoundingBox(), Transform.Empty, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldBounds); - FindGridsIntersecting(mapEnt, polygon, worldBounds.CalcBoundingBox(), Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); } + [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - var polygon = new SlimPolygon(worldBounds); - FindGridsIntersecting(mapEnt, polygon, worldBounds.CalcBoundingBox(), Transform.Empty, ref grids, approx: approx, includeMap: includeMap); + _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref grids, approx: approx, includeMap: includeMap); } #endregion #region TryFindGridAt + [Obsolete("use SharedMapSystem")] public bool TryFindGridAt( EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - var rangeVec = new Vector2(0.2f, 0.2f); - - // Need to enlarge the AABB by at least the grid shrinkage size. - var aabb = new Box2(worldPos - rangeVec, worldPos + rangeVec); - - uid = EntityUid.Invalid; - grid = null; - var state = (uid, grid, worldPos, _mapSystem, _transformSystem); - - FindGridsIntersecting(mapEnt, aabb, ref state, static (EntityUid iUid, MapGridComponent iGrid, ref ( - EntityUid uid, - MapGridComponent? grid, - Vector2 worldPos, - SharedMapSystem mapSystem, - SharedTransformSystem xformSystem) tuple) => - { - // Turn the worldPos into a localPos and work out the relevant chunk we need to check - // This is much faster than iterating over every chunk individually. - // (though now we need some extra calcs up front). - - // Doesn't use WorldBounds because it's just an AABB. - var matrix = tuple.xformSystem.GetInvWorldMatrix(iUid); - var localPos = Vector2.Transform(tuple.worldPos, matrix); - - // NOTE: - // If you change this to use fixtures instead (i.e. if you want half-tiles) then you need to make sure - // you account for the fact that fixtures are shrunk slightly! - var chunkIndices = SharedMapSystem.GetChunkIndices(localPos, iGrid.ChunkSize); - - if (!iGrid.Chunks.TryGetValue(chunkIndices, out var chunk)) - return true; - - var chunkRelative = SharedMapSystem.GetChunkRelative(localPos, iGrid.ChunkSize); - var chunkTile = chunk.GetTile(chunkRelative); - - if (chunkTile.IsEmpty) - return true; - - tuple.uid = iUid; - tuple.grid = iGrid; - return false; - }, approx: true, includeMap: false); - - if (state.grid == null && _gridQuery.TryGetComponent(mapEnt, out var mapGrid)) - { - uid = mapEnt; - grid = mapGrid; - return true; - } - - uid = state.uid; - grid = state.grid; - return grid != null; + return _mapSystem.TryFindGridAt(mapEnt, worldPos, out uid, out grid); } /// /// Attempts to find the map grid under the map location. /// + [Obsolete("use SharedMapSystem")] public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - if (_mapSystem.TryGetMap(mapId, out var map)) - return TryFindGridAt(map.Value, worldPos, out uid, out grid); - - uid = default; - grid = null; - return false; + return _mapSystem.TryFindGridAt(mapId, worldPos, out uid, out grid); } /// /// Attempts to find the map grid under the map location. /// + [Obsolete("use SharedMapSystem")] public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - return TryFindGridAt(mapCoordinates.MapId, mapCoordinates.Position, out uid, out grid); + return _mapSystem.TryFindGridAt(mapCoordinates, out uid, out grid); } #endregion - - private record struct GridQueryState( - GridCallback Callback, - TState State, - Box2 WorldAABB, - T Shape, - Transform Transform, - B2DynamicTree<(EntityUid Uid, FixturesComponent Fixtures, MapGridComponent Grid)> Tree, - SharedMapSystem MapSystem, - MapManager MapManager, - SharedTransformSystem TransformSystem, - bool Approximate); } From e1b090f115c1456cdefa940760a26c9a148a69a9 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 01:44:15 -0700 Subject: [PATCH 02/21] Move CreateGrid to SharedMapSystem Moves the functionality for CreateGrid and its variants to SharedMapSystem Hollows out the MapManager methods and converts them into relays for the SharedMapSystem methods Obsoletes them too Also moves over the GetAllMapGrids and GetAllGrids methods --- .../Systems/SharedMapSystem.Grid.cs | 40 ++++++++++++ .../Systems/SharedMapSystem.Lookup.cs | 16 ++++- Robust.Shared/Map/IMapManager.cs | 7 ++ .../Map/MapManager.GridCollection.cs | 64 +++++-------------- 4 files changed, 76 insertions(+), 51 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 6c21c94534d..f388a747cf0 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -21,6 +21,46 @@ namespace Robust.Shared.GameObjects; public abstract partial class SharedMapSystem { + #region CreateGrid + + public Entity CreateGridEntity(MapId mapId, GridCreateOptions? options = null) + { + return CreateGridEntity(GetMap(mapId), options); + } + + public Entity CreateGridEntity(EntityUid mapEnt, GridCreateOptions? options = null) + { + options ??= GridCreateOptions.Default; + return CreateGridInternal(mapEnt, options.Value); + } + + protected Entity CreateGridInternal(EntityUid mapEnt, GridCreateOptions options) + { + var gridEnt = EntityManager.CreateEntityUninitialized(null); + + var grid = EnsureComp(gridEnt); + grid.ChunkSize = options.ChunkSize; + + Log.Debug("Binding new grid {gridEnt}"); + + //TODO: This is a hack to get TransformComponent.MapId working before entity states + //are applied. After they are applied the parent may be different, but the MapId will + //be the same. This causes TransformComponent.ParentUid of a grid to be unsafe to + //use in transform states anytime before the state parent is properly set. + _transform.SetParent(gridEnt, mapEnt); + + var meta = _metaQuery.GetComponent(gridEnt); + EntityManager.System().SetEntityName(gridEnt, $"grid", meta); + EntityManager.InitializeComponents(gridEnt, meta); + EntityManager.StartComponents(gridEnt); + // Note that this does not actually map-initialize the grid entity, even if the map its being spawn on has already been initialized. + // I don't know whether that is intentional or not. + + return (gridEnt, grid); + } + + #endregion + #region Chunk helpers [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs index 00af546bdfd..1c38c60aee0 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs @@ -308,12 +308,24 @@ public void FindGridsIntersecting( public IEnumerable> GetAllGrids(MapId mapId) { - throw new System.NotImplementedException(); + var query = AllEntityQuery(); + while (query.MoveNext(out var uid, out var grid, out var xform)) + { + if (xform.MapID != mapId) + continue; + + yield return (uid, grid); + } } public IEnumerable GetAllMapGrids(MapId mapId) { - throw new System.NotImplementedException(); + var query = AllEntityQuery(); + while (query.MoveNext(out var grid, out var xform)) + { + if (xform.MapID == mapId) + yield return grid; + } } public void FindGridsIntersecting( diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs index 8855d2366fd..d294b2d8d03 100644 --- a/Robust.Shared/Map/IMapManager.cs +++ b/Robust.Shared/Map/IMapManager.cs @@ -70,14 +70,21 @@ public interface IMapManager void DeleteMap(MapId mapId); // ReSharper disable once MethodOverloadWithOptionalParameter + [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] MapGridComponent CreateGrid(MapId currentMapId, ushort chunkSize = 16); + [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] MapGridComponent CreateGrid(MapId currentMapId, in GridCreateOptions options); + [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] MapGridComponent CreateGrid(MapId currentMapId); + [Obsolete("Use MapSystem")] Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null); + [Obsolete("Use MapSystem")] Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null); + [Obsolete("Use MapSystem")] IEnumerable GetAllMapGrids(MapId mapId); + [Obsolete("Use MapSystem")] IEnumerable> GetAllGrids(MapId mapId); #region MapId diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs index cf23be33c1c..96f89e7547b 100644 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ b/Robust.Shared/Map/MapManager.GridCollection.cs @@ -1,42 +1,42 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using Robust.Shared.GameObjects; using Robust.Shared.Map.Components; using Robust.Shared.Maths; using Robust.Shared.Utility; -// All the obsolete warnings about GridId are probably useless here. -#pragma warning disable CS0618 - namespace Robust.Shared.Map; internal partial class MapManager { // ReSharper disable once MethodOverloadWithOptionalParameter + [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] public MapGridComponent CreateGrid(MapId currentMapId, ushort chunkSize = 16) { - return CreateGrid(GetMapEntityIdOrThrow(currentMapId), chunkSize, default); + return CreateGridEntity(currentMapId, options: GridCreateOptions.Default with { ChunkSize = chunkSize }).Comp; } + [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] public MapGridComponent CreateGrid(MapId currentMapId, in GridCreateOptions options) { - return CreateGrid(GetMapEntityIdOrThrow(currentMapId), options.ChunkSize, default); + return CreateGridEntity(currentMapId, options: options).Comp; } + [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] public MapGridComponent CreateGrid(MapId currentMapId) { - return CreateGrid(currentMapId, GridCreateOptions.Default); + return CreateGridEntity(currentMapId, options: GridCreateOptions.Default).Comp; } + [Obsolete("use SharedMapSystem.CreateGridEntity")] public Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null) { - return CreateGridEntity(GetMapEntityIdOrThrow(currentMapId), options); + return _mapSystem.CreateGridEntity(currentMapId, options: options); } + [Obsolete("use SharedMapSystem.CreateGridEntity")] public Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null) { - options ??= GridCreateOptions.Default; - return CreateGrid(map, options.Value.ChunkSize, default); + return _mapSystem.CreateGridEntity(map, options: options); } [Obsolete("Use HasComponent(uid)")] @@ -45,28 +45,19 @@ public bool IsGrid(EntityUid uid) return EntityManager.HasComponent(uid); } + [Obsolete("use SharedMapSystem.GetAllMapGrids")] public IEnumerable GetAllMapGrids(MapId mapId) { - var query = EntityManager.AllEntityQueryEnumerator(); - while (query.MoveNext(out var grid, out var xform)) - { - if (xform.MapID == mapId) - yield return grid; - } + return _mapSystem.GetAllMapGrids(mapId); } + [Obsolete("use SharedMapSystem.GetAllGrids")] public IEnumerable> GetAllGrids(MapId mapId) { - var query = EntityManager.AllEntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var grid, out var xform)) - { - if (xform.MapID != mapId) - continue; - - yield return (uid, grid); - } + return _mapSystem.GetAllGrids(mapId); } + [Obsolete("just delete the grid entity")] public virtual void DeleteGrid(EntityUid euid) { // Possible the grid was already deleted / is invalid @@ -104,29 +95,4 @@ void IMapManagerInternal.RaiseOnTileChanged(Entity entity, Til var ev = new TileChangedEvent(entity, tileRef, oldTile, chunk); EntityManager.EventBus.RaiseLocalEvent(entity.Owner, ref ev, true); } - - protected Entity CreateGrid(EntityUid map, ushort chunkSize, EntityUid forcedGridEuid) - { - var gridEnt = EntityManager.CreateEntityUninitialized(null, forcedGridEuid); - - var grid = EntityManager.AddComponent(gridEnt); - grid.ChunkSize = chunkSize; - - _sawmill.Debug($"Binding new grid {gridEnt}"); - - //TODO: This is a hack to get TransformComponent.MapId working before entity states - //are applied. After they are applied the parent may be different, but the MapId will - //be the same. This causes TransformComponent.ParentUid of a grid to be unsafe to - //use in transform states anytime before the state parent is properly set. - EntityManager.GetComponent(gridEnt).AttachParent(map); - - var meta = EntityManager.GetComponent(gridEnt); - EntityManager.System().SetEntityName(gridEnt, $"grid", meta); - EntityManager.InitializeComponents(gridEnt, meta); - EntityManager.StartComponents(gridEnt); - // Note that this does not actually map-initialize the grid entity, even if the map its being spawn on has already been initialized. - // I don't know whether that is intentional or not. - - return (gridEnt, grid); - } } From 9220fac16911c1fab55a963bbfd6ccad9ed20da4 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:02:51 -0700 Subject: [PATCH 03/21] Move RaiseOnTileChanged to SharedMapSystem Also moves the SuppressOnTileChanged flag member to SharedMapSystem Hollows out and obsoletes the MapManager versions --- .../Systems/SharedMapSystem.Grid.cs | 19 ++++++++++++++----- .../GameObjects/Systems/SharedMapSystem.cs | 8 ++++++++ Robust.Shared/Map/IMapManager.cs | 1 + Robust.Shared/Map/IMapManagerInternal.cs | 2 ++ .../Map/MapManager.GridCollection.cs | 14 ++++++++------ 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index f388a747cf0..48b45568dbf 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -362,7 +362,7 @@ private void ApplyChunkData( var gridIndices = deletedChunk.ChunkTileToGridTile((x, y)); var newTileRef = new TileRef(uid, gridIndices, Tile.Empty); - _mapInternal.RaiseOnTileChanged(gridEnt, newTileRef, oldTile, index); + RaiseOnTileChanged(gridEnt, newTileRef, oldTile, index); } } @@ -886,7 +886,7 @@ public void SetTiles(EntityUid uid, MapGridComponent grid, List<(Vector2i GridIn // Suppress sending out events for each tile changed // We're going to send them all out together at the end - MapManager.SuppressOnTileChanged = true; + SuppressOnTileChanged = true; foreach (var (gridIndices, tile) in tiles) { @@ -923,7 +923,7 @@ public void SetTiles(EntityUid uid, MapGridComponent grid, List<(Vector2i GridIn RegenerateCollision(uid, grid, modified); // Back to normal - MapManager.SuppressOnTileChanged = false; + SuppressOnTileChanged = false; } public TilesEnumerator GetLocalTilesEnumerator(EntityUid uid, MapGridComponent grid, Box2 aabb, @@ -1671,10 +1671,10 @@ private void OnTileModified(EntityUid uid, MapGridComponent grid, MapChunk mapCh // The map serializer currently sets tiles of unbound grids as part of the deserialization process // It properly sets SuppressOnTileChanged so that the event isn't spammed for every tile on the grid. // ParentMapId is not able to be accessed on unbound grids, so we can't even call this function for unbound grids. - if (!MapManager.SuppressOnTileChanged) + if (!SuppressOnTileChanged) { var newTileRef = new TileRef(uid, gridTile, newTile); - _mapInternal.RaiseOnTileChanged((uid, grid), newTileRef, oldTile, mapChunk.Indices); + RaiseOnTileChanged((uid, grid), newTileRef, oldTile, mapChunk.Indices); } if (shapeChanged && !mapChunk.SuppressCollisionRegeneration) @@ -1683,6 +1683,15 @@ private void OnTileModified(EntityUid uid, MapGridComponent grid, MapChunk mapCh } } + internal void RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk) + { + if (SuppressOnTileChanged) + return; + + var ev = new TileChangedEvent(entity, tileRef, oldTile, chunk); + EntityManager.EventBus.RaiseLocalEvent(entity.Owner, ref ev, true); + } + /// /// Iterates the local tiles of the specified data. /// diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs index 16e07f3d50f..94486e8077e 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs @@ -40,6 +40,14 @@ public abstract partial class SharedMapSystem : EntitySystem internal Dictionary Maps { get; } = new(); + /// + /// If set, this prevents the from being raised when modifying grids. + /// + /// + /// Useful if you want to create a new grid, delete an existing grid, or bulk-modify tiles and don't want to spam ten billion individual tile-changed events. + /// + internal bool SuppressOnTileChanged { get; set; } + /// /// This hashset is used to try prevent MapId re-use. This is mainly for auto-assigned map ids. /// Loading a map with a specific id (e.g., the various mapping commands) may still result in an id being diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs index d294b2d8d03..c3cd767a8e2 100644 --- a/Robust.Shared/Map/IMapManager.cs +++ b/Robust.Shared/Map/IMapManager.cs @@ -28,6 +28,7 @@ public interface IMapManager /// Should the OnTileChanged event be suppressed? This is useful for initially loading the map /// so that you don't spam an event for each of the million station tiles. /// + [Obsolete("use SharedMapSystem")] bool SuppressOnTileChanged { get; set; } /// diff --git a/Robust.Shared/Map/IMapManagerInternal.cs b/Robust.Shared/Map/IMapManagerInternal.cs index e6a5b5b3637..bbc3debc343 100644 --- a/Robust.Shared/Map/IMapManagerInternal.cs +++ b/Robust.Shared/Map/IMapManagerInternal.cs @@ -1,3 +1,4 @@ +using System; using Robust.Shared.GameObjects; using Robust.Shared.Map.Components; using Robust.Shared.Maths; @@ -12,6 +13,7 @@ internal interface IMapManagerInternal : IMapManager /// /// A reference to the new tile. /// The old tile that got replaced. + [Obsolete("use SharedMapSystem")] void RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk); } } diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs index 96f89e7547b..a1034c9f3e4 100644 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ b/Robust.Shared/Map/MapManager.GridCollection.cs @@ -80,19 +80,21 @@ public virtual void DeleteGrid(EntityUid euid) } /// - public bool SuppressOnTileChanged { get; set; } + [Obsolete("use SharedMapSystem.SuppressOnTileChanged")] + public bool SuppressOnTileChanged + { + get => _mapSystem.SuppressOnTileChanged; + set { _mapSystem.SuppressOnTileChanged = value; } + } /// /// Raises the OnTileChanged event. /// /// A reference to the new tile. /// The old tile that got replaced. + [Obsolete("use SharedMapSystem.RaiseOnTileChanged")] void IMapManagerInternal.RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk) { - if (SuppressOnTileChanged) - return; - - var ev = new TileChangedEvent(entity, tileRef, oldTile, chunk); - EntityManager.EventBus.RaiseLocalEvent(entity.Owner, ref ev, true); + _mapSystem.RaiseOnTileChanged(entity, tileRef, oldTile, chunk); } } From 541975bcb79a14591d9ee0a794a9adbddcbb9589 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:03:22 -0700 Subject: [PATCH 04/21] Move default value constants to SharedMapSystem --- .../Systems/SharedMapSystem.Lookup.cs | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs index 1c38c60aee0..39ed8e8109c 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs @@ -14,6 +14,17 @@ namespace Robust.Shared.GameObjects; public abstract partial class SharedMapSystem { + + /// + /// Whether and its extended family should only approximately check for intersection by default. + /// + public const bool Approximate = false; + + /// + /// Whether and its extended family should also check the map itself by default. + /// + public const bool IncludeMap = true; + #region TryFindGridAt public bool TryFindGridAt(EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) @@ -97,8 +108,8 @@ public void FindGridsIntersecting( T shape, Transform transform, ref List> grids, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) where T : IPhysShape + bool approx = Approximate, + bool includeMap = IncludeMap) where T : IPhysShape { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, shape, transform, ref grids, approx: approx, includeMap: includeMap); @@ -109,8 +120,8 @@ public void FindGridsIntersecting( T shape, Transform transform, GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) where T : IPhysShape + bool approx = Approximate, + bool includeMap = IncludeMap) where T : IPhysShape { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, shape, transform, callback, approx: approx, includeMap: includeMap); @@ -120,8 +131,8 @@ public void FindGridsIntersecting( MapId mapId, Box2 worldAABB, GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, worldAABB, callback, approx: approx, includeMap: includeMap); @@ -132,8 +143,8 @@ public void FindGridsIntersecting( Box2 worldAABB, ref TState state, GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var map)) FindGridsIntersecting(map.Value, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); @@ -143,8 +154,8 @@ public void FindGridsIntersecting( MapId mapId, Box2 worldAABB, ref List> grids, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var map)) FindGridsIntersecting(map.Value, worldAABB, ref grids, approx: approx, includeMap: includeMap); @@ -154,8 +165,8 @@ public void FindGridsIntersecting( MapId mapId, Box2Rotated worldBounds, GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, worldBounds, callback, approx: approx, includeMap: includeMap); @@ -166,8 +177,8 @@ public void FindGridsIntersecting( Box2Rotated worldBounds, ref TState state, GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); @@ -177,8 +188,8 @@ public void FindGridsIntersecting( MapId mapId, Box2Rotated worldBounds, ref List> grids, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) + bool approx = Approximate, + bool includeMap = IncludeMap) { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, worldBounds, ref grids, approx: approx, includeMap: includeMap); @@ -193,8 +204,8 @@ public void FindGridsIntersecting( TShape shape, Transform transform, GridCallback callback, - bool approx = false, - bool includeMap = true) where TShape : IPhysShape + bool approx = Approximate, + bool includeMap = IncludeMap) where TShape : IPhysShape { FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, callback, approx: approx, includeMap: includeMap); } @@ -205,8 +216,8 @@ public void FindGridsIntersecting( Transform transform, ref TState state, GridCallback callback, - bool approx = false, - bool includeMap = true) where TShape : IPhysShape + bool approx = Approximate, + bool includeMap = IncludeMap) where TShape : IPhysShape { FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref state, callback, approx: approx, includeMap: includeMap); } @@ -216,8 +227,8 @@ public void FindGridsIntersecting( List shapes, Transform transform, ref List> entities, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { foreach (var shape in shapes) { @@ -230,8 +241,8 @@ public void FindGridsIntersecting( TShape shape, Transform transform, ref List> grids, - bool approx = false, - bool includeMap = true) where TShape : IPhysShape + bool approx = Approximate, + bool includeMap = IncludeMap) where TShape : IPhysShape { FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref grids, approx: approx, includeMap: includeMap); } @@ -240,8 +251,8 @@ public void FindGridsIntersecting( EntityUid mapEnt, Box2 worldAABB, GridCallback callback, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldAABB); FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); @@ -252,8 +263,8 @@ public void FindGridsIntersecting( Box2 worldAABB, ref TState state, GridCallback callback, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldAABB); FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); @@ -263,8 +274,8 @@ public void FindGridsIntersecting( EntityUid mapEnt, Box2 worldAABB, ref List> grids, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldAABB); FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref grids, approx: approx, includeMap: includeMap); @@ -274,8 +285,8 @@ public void FindGridsIntersecting( EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldBounds); FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); @@ -286,8 +297,8 @@ public void FindGridsIntersecting( Box2Rotated worldBounds, ref TState state, GridCallback callback, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldBounds); FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); @@ -297,8 +308,8 @@ public void FindGridsIntersecting( EntityUid mapEnt, Box2Rotated worldBounds, ref List> grids, - bool approx = false, - bool includeMap = true) + bool approx = Approximate, + bool includeMap = IncludeMap) { var shape = new SlimPolygon(worldBounds); FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, ref grids, approx: approx, includeMap: includeMap); From 41bbaa9eaaa8be80499449907bbf768d3026ee67 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:22:30 -0700 Subject: [PATCH 05/21] Converts map pausing events into LocalizedEntityCommands --- Resources/Locale/en-US/commands.ftl | 9 +++ .../Map/Commands/MapPausingCommands.cs | 81 +++++++++++++++++++ Robust.Shared/Map/MapManager.Pause.cs | 66 --------------- Robust.Shared/Map/MapManager.cs | 13 --- 4 files changed, 90 insertions(+), 79 deletions(-) create mode 100644 Robust.Shared/Map/Commands/MapPausingCommands.cs diff --git a/Resources/Locale/en-US/commands.ftl b/Resources/Locale/en-US/commands.ftl index 4d4e3264618..fcafc42eedf 100644 --- a/Resources/Locale/en-US/commands.ftl +++ b/Resources/Locale/en-US/commands.ftl @@ -306,6 +306,15 @@ cmd-addmap-help = Usage: {$command} [pre-init] cmd-rmmap-desc = Removes a map from the world. You cannot remove nullspace. cmd-rmmap-help = Usage: {$command} +cmd-pausemap-desc = Pauses a map, pausing all simulation processing on it. +cmd-pausemap-help = Usage: pausemap + +cmd-unpausemap-desc = Unpauses a map, resuming all simulation processing on it. +cmd-unpausemap-help = Usage: unpausemap + +cmd-querymappaused-desc = Check whether a map is paused or not. +cmd-querymappaused-help = Usage: querymappaused + cmd-savegrid-desc = Serializes a grid to disk. cmd-savegrid-help = Usage: {$command} diff --git a/Robust.Shared/Map/Commands/MapPausingCommands.cs b/Robust.Shared/Map/Commands/MapPausingCommands.cs new file mode 100644 index 00000000000..6f2a2a80538 --- /dev/null +++ b/Robust.Shared/Map/Commands/MapPausingCommands.cs @@ -0,0 +1,81 @@ +using System.Globalization; +using Robust.Shared.Console; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; + +namespace Robust.Shared.Map.Commands; + +public sealed partial class PauseMapCommand : LocalizedEntityCommands +{ + [Dependency] SharedMapSystem _mapSystem = default!; + public override string Command => "pausemap"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1) + { + shell.WriteError("Need to supply a valid MapId"); + return; + } + + var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); + + if (!_mapSystem.MapExists(mapId)) + { + shell.WriteError("That map does not exist."); + return; + } + + _mapSystem.SetPaused(mapId, true); + } +} + +public sealed partial class UnpauseMapCommand : LocalizedEntityCommands +{ + [Dependency] SharedMapSystem _mapSystem = default!; + public override string Command => "unpausemap"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1) + { + shell.WriteError("Need to supply a valid MapId"); + return; + } + + var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); + + if (!_mapSystem.MapExists(mapId)) + { + shell.WriteError("That map does not exist."); + return; + } + + _mapSystem.SetPaused(mapId, false); + } +} + +public sealed partial class QueryMapPausedCommand : LocalizedEntityCommands +{ + [Dependency] SharedMapSystem _mapSystem = default!; + public override string Command => "querymappaused"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1) + { + shell.WriteError("Need to supply a valid MapId"); + return; + } + + var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); + + if (!_mapSystem.MapExists(mapId)) + { + shell.WriteError("That map does not exist."); + return; + } + + shell.WriteLine(_mapSystem.IsPaused(mapId).ToString()); + } +} diff --git a/Robust.Shared/Map/MapManager.Pause.cs b/Robust.Shared/Map/MapManager.Pause.cs index d4fb8f58976..49a76ec5eaf 100644 --- a/Robust.Shared/Map/MapManager.Pause.cs +++ b/Robust.Shared/Map/MapManager.Pause.cs @@ -36,71 +36,5 @@ public bool IsMapPaused(EntityUid uid) { return _mapSystem.IsPaused(uid); } - - /// - /// Initializes the map pausing system. - /// - private void InitializeMapPausing() - { - _conhost.RegisterCommand("pausemap", - "Pauses a map, pausing all simulation processing on it.", - "pausemap ", - (shell, _, args) => - { - if (args.Length != 1) - { - shell.WriteError("Need to supply a valid MapId"); - return; - } - - var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); - - if (!MapExists(mapId)) - { - shell.WriteError("That map does not exist."); - return; - } - - SetMapPaused(mapId, true); - }); - - _conhost.RegisterCommand("querymappaused", - "Check whether a map is paused or not.", - "querymappaused ", - (shell, _, args) => - { - var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); - - if (!MapExists(mapId)) - { - shell.WriteError("That map does not exist."); - return; - } - - shell.WriteLine(_mapSystem.IsPaused(mapId).ToString()); - }); - - _conhost.RegisterCommand("unpausemap", - "unpauses a map, resuming all simulation processing on it.", - "Usage: unpausemap ", - (shell, _, args) => - { - if (args.Length != 1) - { - shell.WriteLine("Need to supply a valid MapId"); - return; - } - - var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture)); - - if (!MapExists(mapId)) - { - shell.WriteLine("That map does not exist."); - return; - } - - SetMapPaused(mapId, false); - }); - } } } diff --git a/Robust.Shared/Map/MapManager.cs b/Robust.Shared/Map/MapManager.cs index c5e853c8b63..9b4f1b753b0 100644 --- a/Robust.Shared/Map/MapManager.cs +++ b/Robust.Shared/Map/MapManager.cs @@ -13,35 +13,22 @@ namespace Robust.Shared.Map; [Virtual] internal partial class MapManager : IMapManagerInternal, IEntityEventSubscriber { - [Dependency] public IGameTiming GameTiming = default!; [Dependency] public IEntityManager EntityManager = default!; - [Dependency] private IManifoldManager _manifolds = default!; [Dependency] private ILogManager _logManager = default!; - [Dependency] private IConsoleHost _conhost = default!; private ISawmill _sawmill = default!; private SharedMapSystem _mapSystem = default!; - private SharedPhysicsSystem _physics = default!; - private SharedTransformSystem _transformSystem = default!; - - private EntityQuery _gridTreeQuery; - private EntityQuery _gridQuery; /// public void Initialize() { - _gridTreeQuery = EntityManager.GetEntityQuery(); - _gridQuery = EntityManager.GetEntityQuery(); - InitializeMapPausing(); _sawmill = _logManager.GetSawmill("system.map"); } /// public void Startup() { - _physics = EntityManager.System(); - _transformSystem = EntityManager.System(); _mapSystem = EntityManager.System(); _sawmill.Debug("Starting..."); From bd890ffe3fee20f17573906c4c70ba6c5fc4a14c Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:30:59 -0700 Subject: [PATCH 06/21] Move MapManager related delegates/structs to SharedMapSystem Moves the GridCreationOptions struct to the same namespace as SharedMapSystem and converts it into a record struct Move the GridCallback delegates to the same namespace as SharedMapSystem --- .../Systems/SharedMapSystem.Grid.cs | 5 +++++ .../Systems/SharedMapSystem.Lookup.cs | 3 +++ Robust.Shared/Map/IMapManager.cs | 20 ++----------------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 48b45568dbf..3511f0bea14 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -1787,3 +1787,8 @@ public bool MoveNext(out TileRef tile) } } } + +public record struct GridCreateOptions(ushort ChunkSize) +{ + public readonly static GridCreateOptions Default = new(ChunkSize: 16); +} diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs index 39ed8e8109c..d00cb55ea07 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs @@ -473,3 +473,6 @@ private record struct GridQueryState( bool Approximate ) where TShape : IPhysShape; } + +public delegate bool GridCallback(EntityUid gridUid, MapGridComponent gridComp); +public delegate bool GridCallback(EntityUid gridUid, MapGridComponent gridComp, ref TState state); diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs index c3cd767a8e2..fad26a165af 100644 --- a/Robust.Shared/Map/IMapManager.cs +++ b/Robust.Shared/Map/IMapManager.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Numerics; -using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.Map.Components; using Robust.Shared.Maths; @@ -11,18 +10,14 @@ namespace Robust.Shared.Map { - public delegate bool GridCallback(EntityUid uid, MapGridComponent grid); - - public delegate bool GridCallback(EntityUid uid, MapGridComponent grid, ref TState state); - /// /// This manages all the grids and maps in the world. Largely superseded by . /// [NotContentImplementable] public interface IMapManager { - public const bool Approximate = false; - public const bool IncludeMap = true; + public const bool Approximate = SharedMapSystem.Approximate; + public const bool IncludeMap = SharedMapSystem.IncludeMap; /// /// Should the OnTileChanged event be suppressed? This is useful for initially loading the map @@ -260,16 +255,5 @@ public IEnumerable FindGridsIntersecting(MapId mapId, Box2Rota [Obsolete("Use MapSystem")] bool IsMapInitialized(MapId mapId); - - } - - public struct GridCreateOptions - { - public static readonly GridCreateOptions Default = new() - { - ChunkSize = 16 - }; - - public ushort ChunkSize; } } From cc10ab40773886e0bf351a98badc030a125a89d5 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:42:46 -0700 Subject: [PATCH 07/21] Move CullDeletionHistory to SharedMapSystem Well, that was less painful than I thought it would be --- Robust.Server/GameStates/PvsSystem.Chunks.cs | 2 +- Robust.Server/GameStates/PvsSystem.cs | 4 ++-- .../GameObjects/Systems/SharedMapSystem.Grid.cs | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Robust.Server/GameStates/PvsSystem.Chunks.cs b/Robust.Server/GameStates/PvsSystem.Chunks.cs index 99466b1f6b7..a270c7410b7 100644 --- a/Robust.Server/GameStates/PvsSystem.Chunks.cs +++ b/Robust.Server/GameStates/PvsSystem.Chunks.cs @@ -133,7 +133,7 @@ private void GetVisibleChunks(Entity eye, _grids.Clear(); var rangeVec = new Vector2(range, range); var box = new Box2(viewPos - rangeVec, viewPos + rangeVec); - _mapManager.FindGridsIntersecting(map, box, ref _grids, approx: true, includeMap: false); + _maps.FindGridsIntersecting(map, box, ref _grids, approx: true, includeMap: false); foreach (var (grid, _) in _grids) { diff --git a/Robust.Server/GameStates/PvsSystem.cs b/Robust.Server/GameStates/PvsSystem.cs index 2095023f220..02615e9ea73 100644 --- a/Robust.Server/GameStates/PvsSystem.cs +++ b/Robust.Server/GameStates/PvsSystem.cs @@ -28,7 +28,6 @@ namespace Robust.Server.GameStates; internal sealed partial class PvsSystem : EntitySystem { [Dependency] private IConfigurationManager _configManager = default!; - [Dependency] private INetworkedMapManager _mapManager = default!; [Dependency] private IServerEntityNetworkManager _netEntMan = default!; [Dependency] private IPlayerManager _playerManager = default!; [Dependency] private IParallelManager _parallelManager = default!; @@ -40,6 +39,7 @@ internal sealed partial class PvsSystem : EntitySystem [Dependency] private IParallelManagerInternal _parallelMgr = default!; [Dependency] private PvsOverrideSystem _pvsOverride = default!; [Dependency] private IServerReplayRecordingManager _replay = default!; + [Dependency] private SharedMapSystem _maps = default!; // TODO make this a cvar. Make it in terms of seconds and tie it to tick rate? // Main issue is that I CBF figuring out the logic for handling it changing mid-game. @@ -288,7 +288,7 @@ private void CullDeletionHistory(GameTick oldestAck) { using var _ = Histogram.WithLabels("Cull History").NewTimer(); CullDeletionHistoryUntil(oldestAck); - _mapManager.CullDeletionHistory(oldestAck); + _maps.CullDeletionHistory(oldestAck); } private void GetEntityStates(PvsSession session) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 3511f0bea14..6de54c1b019 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -524,6 +524,17 @@ private void GetFullState(EntityUid uid, MapGridComponent component, ref Compone #endif } + public void CullDeletionHistory(GameTick upToTick) + { + var query = AllEntityQuery(); + + while (query.MoveNext(out var grid)) + { + var chunks = grid.ChunkDeletionHistory; + chunks.RemoveAll(t => t.tick < upToTick); + } + } + private void OnGridAdd(EntityUid uid, MapGridComponent component, ComponentAdd args) { var msg = new GridAddEvent(uid); From 7b0e32055216febe4a83ab37fb17227ee3b5cd65 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 02:50:06 -0700 Subject: [PATCH 08/21] Actually obsolete the NetworkedMapManager method --- Robust.Shared/Map/IMapManagerInternal.cs | 1 + .../Map/MapManager.GridCollection.cs | 14 +++--- Robust.Shared/Map/MapManager.MapCollection.cs | 16 +++---- Robust.Shared/Map/MapManager.Pause.cs | 12 ++--- Robust.Shared/Map/MapManager.Queries.cs | 44 +++++++++---------- Robust.Shared/Map/MapManager.cs | 8 +--- Robust.Shared/Map/NetworkedMapManager.cs | 14 +++--- 7 files changed, 52 insertions(+), 57 deletions(-) diff --git a/Robust.Shared/Map/IMapManagerInternal.cs b/Robust.Shared/Map/IMapManagerInternal.cs index bbc3debc343..c2b19a20f21 100644 --- a/Robust.Shared/Map/IMapManagerInternal.cs +++ b/Robust.Shared/Map/IMapManagerInternal.cs @@ -6,6 +6,7 @@ namespace Robust.Shared.Map { /// + [Obsolete] internal interface IMapManagerInternal : IMapManager { /// diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs index a1034c9f3e4..75502418251 100644 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ b/Robust.Shared/Map/MapManager.GridCollection.cs @@ -30,13 +30,13 @@ public MapGridComponent CreateGrid(MapId currentMapId) [Obsolete("use SharedMapSystem.CreateGridEntity")] public Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null) { - return _mapSystem.CreateGridEntity(currentMapId, options: options); + return MapSystem.CreateGridEntity(currentMapId, options: options); } [Obsolete("use SharedMapSystem.CreateGridEntity")] public Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null) { - return _mapSystem.CreateGridEntity(map, options: options); + return MapSystem.CreateGridEntity(map, options: options); } [Obsolete("Use HasComponent(uid)")] @@ -48,13 +48,13 @@ public bool IsGrid(EntityUid uid) [Obsolete("use SharedMapSystem.GetAllMapGrids")] public IEnumerable GetAllMapGrids(MapId mapId) { - return _mapSystem.GetAllMapGrids(mapId); + return MapSystem.GetAllMapGrids(mapId); } [Obsolete("use SharedMapSystem.GetAllGrids")] public IEnumerable> GetAllGrids(MapId mapId) { - return _mapSystem.GetAllGrids(mapId); + return MapSystem.GetAllGrids(mapId); } [Obsolete("just delete the grid entity")] @@ -83,8 +83,8 @@ public virtual void DeleteGrid(EntityUid euid) [Obsolete("use SharedMapSystem.SuppressOnTileChanged")] public bool SuppressOnTileChanged { - get => _mapSystem.SuppressOnTileChanged; - set { _mapSystem.SuppressOnTileChanged = value; } + get => MapSystem.SuppressOnTileChanged; + set { MapSystem.SuppressOnTileChanged = value; } } /// @@ -95,6 +95,6 @@ public bool SuppressOnTileChanged [Obsolete("use SharedMapSystem.RaiseOnTileChanged")] void IMapManagerInternal.RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk) { - _mapSystem.RaiseOnTileChanged(entity, tileRef, oldTile, chunk); + MapSystem.RaiseOnTileChanged(entity, tileRef, oldTile, chunk); } } diff --git a/Robust.Shared/Map/MapManager.MapCollection.cs b/Robust.Shared/Map/MapManager.MapCollection.cs index e8a5f44e181..3810652f9a4 100644 --- a/Robust.Shared/Map/MapManager.MapCollection.cs +++ b/Robust.Shared/Map/MapManager.MapCollection.cs @@ -30,7 +30,7 @@ internal partial class MapManager /// public virtual void DeleteMap(MapId mapId) { - _mapSystem.DeleteMap(mapId); + MapSystem.DeleteMap(mapId); } /// @@ -38,24 +38,24 @@ public MapId CreateMap(MapId? mapId = null) { if (mapId != null) { - _mapSystem.CreateMap(mapId.Value); + MapSystem.CreateMap(mapId.Value); return mapId.Value; } - _mapSystem.CreateMap(out var map); + MapSystem.CreateMap(out var map); return map; } /// public bool MapExists([NotNullWhen(true)] MapId? mapId) { - return _mapSystem.MapExists(mapId); + return MapSystem.MapExists(mapId); } /// public EntityUid GetMapEntityId(MapId mapId) { - return _mapSystem.GetMapOrInvalid(mapId); + return MapSystem.GetMapOrInvalid(mapId); } /// @@ -63,18 +63,18 @@ public EntityUid GetMapEntityId(MapId mapId) /// public EntityUid GetMapEntityIdOrThrow(MapId mapId) { - return _mapSystem.GetMap(mapId); + return MapSystem.GetMap(mapId); } public bool TryGetMap([NotNullWhen(true)] MapId? mapId, [NotNullWhen(true)] out EntityUid? uid) { - return _mapSystem.TryGetMap(mapId, out uid); + return MapSystem.TryGetMap(mapId, out uid); } /// public IEnumerable GetAllMapIds() { - return _mapSystem.GetAllMapIds(); + return MapSystem.GetAllMapIds(); } /// diff --git a/Robust.Shared/Map/MapManager.Pause.cs b/Robust.Shared/Map/MapManager.Pause.cs index 49a76ec5eaf..35415537c4a 100644 --- a/Robust.Shared/Map/MapManager.Pause.cs +++ b/Robust.Shared/Map/MapManager.Pause.cs @@ -7,34 +7,34 @@ internal partial class MapManager { public void SetMapPaused(MapId mapId, bool paused) { - _mapSystem.SetPaused(mapId, paused); + MapSystem.SetPaused(mapId, paused); } public void SetMapPaused(EntityUid uid, bool paused) { - _mapSystem.SetPaused(uid, paused); + MapSystem.SetPaused(uid, paused); } public void DoMapInitialize(MapId mapId) { - _mapSystem.InitializeMap(mapId); + MapSystem.InitializeMap(mapId); } public bool IsMapInitialized(MapId mapId) { - return _mapSystem.IsInitialized(mapId); + return MapSystem.IsInitialized(mapId); } /// public bool IsMapPaused(MapId mapId) { - return _mapSystem.IsPaused(mapId); + return MapSystem.IsPaused(mapId); } /// public bool IsMapPaused(EntityUid uid) { - return _mapSystem.IsPaused(uid); + return MapSystem.IsPaused(uid); } } } diff --git a/Robust.Shared/Map/MapManager.Queries.cs b/Robust.Shared/Map/MapManager.Queries.cs index 0799927e63f..8916fa76d84 100644 --- a/Robust.Shared/Map/MapManager.Queries.cs +++ b/Robust.Shared/Map/MapManager.Queries.cs @@ -18,53 +18,53 @@ internal partial class MapManager public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapId, shape, transform, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, shape, transform, ref grids, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapId, shape, transform, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, shape, transform, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldAABB, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldAABB, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldAABB, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldAABB, ref grids, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldBounds, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldBounds, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapId, worldBounds, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapId, worldBounds, ref grids, approx: approx, includeMap: includeMap); } #endregion @@ -80,7 +80,7 @@ public void FindGridsIntersecting( bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, shape, transform, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] @@ -93,7 +93,7 @@ public void FindGridsIntersecting( bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref state, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref state, callback, approx: approx, includeMap: includeMap); } /// @@ -102,61 +102,61 @@ public void FindGridsIntersecting( [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, List shapes, Transform transform, ref List> entities, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, shapes, transform, ref entities, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, shapes, transform, ref entities, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref grids, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, T shape, Box2 worldAABB, Transform transform, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape { - _mapSystem.FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref grids, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldAABB, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref grids, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldBounds, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); } [Obsolete("use SharedMapSystem")] public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) { - _mapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref grids, approx: approx, includeMap: includeMap); + MapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref grids, approx: approx, includeMap: includeMap); } #endregion @@ -170,7 +170,7 @@ public bool TryFindGridAt( out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - return _mapSystem.TryFindGridAt(mapEnt, worldPos, out uid, out grid); + return MapSystem.TryFindGridAt(mapEnt, worldPos, out uid, out grid); } /// @@ -179,7 +179,7 @@ public bool TryFindGridAt( [Obsolete("use SharedMapSystem")] public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - return _mapSystem.TryFindGridAt(mapId, worldPos, out uid, out grid); + return MapSystem.TryFindGridAt(mapId, worldPos, out uid, out grid); } /// @@ -188,7 +188,7 @@ public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [Not [Obsolete("use SharedMapSystem")] public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { - return _mapSystem.TryFindGridAt(mapCoordinates, out uid, out grid); + return MapSystem.TryFindGridAt(mapCoordinates, out uid, out grid); } #endregion diff --git a/Robust.Shared/Map/MapManager.cs b/Robust.Shared/Map/MapManager.cs index 9b4f1b753b0..3bfd5f3e3ce 100644 --- a/Robust.Shared/Map/MapManager.cs +++ b/Robust.Shared/Map/MapManager.cs @@ -1,11 +1,7 @@ -using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map.Components; -using Robust.Shared.Physics.Collision; -using Robust.Shared.Physics.Systems; -using Robust.Shared.Timing; namespace Robust.Shared.Map; @@ -18,7 +14,7 @@ internal partial class MapManager : IMapManagerInternal, IEntityEventSubscriber private ISawmill _sawmill = default!; - private SharedMapSystem _mapSystem = default!; + protected SharedMapSystem MapSystem = default!; /// public void Initialize() @@ -29,7 +25,7 @@ public void Initialize() /// public void Startup() { - _mapSystem = EntityManager.System(); + MapSystem = EntityManager.System(); _sawmill.Debug("Starting..."); } diff --git a/Robust.Shared/Map/NetworkedMapManager.cs b/Robust.Shared/Map/NetworkedMapManager.cs index 683916bc46d..fdfbfadf781 100644 --- a/Robust.Shared/Map/NetworkedMapManager.cs +++ b/Robust.Shared/Map/NetworkedMapManager.cs @@ -1,23 +1,21 @@ -using Robust.Shared.Map.Components; +using System; using Robust.Shared.Timing; namespace Robust.Shared.Map; +[Obsolete] internal interface INetworkedMapManager : IMapManagerInternal { + [Obsolete] void CullDeletionHistory(GameTick upToTick); } +[Obsolete] internal sealed class NetworkedMapManager : MapManager, INetworkedMapManager { + [Obsolete] public void CullDeletionHistory(GameTick upToTick) { - var query = EntityManager.AllEntityQueryEnumerator(); - - while (query.MoveNext(out var grid)) - { - var chunks = grid.ChunkDeletionHistory; - chunks.RemoveAll(t => t.tick < upToTick); - } + MapSystem.CullDeletionHistory(upToTick); } } From d8f4a284981874f00c6ff078886b1960bb412103 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 21:42:53 -0700 Subject: [PATCH 09/21] Rename file --- ...{SharedMapSystem.Lookup.cs => SharedMapSystem.Grid.Queries.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Robust.Shared/GameObjects/Systems/{SharedMapSystem.Lookup.cs => SharedMapSystem.Grid.Queries.cs} (100%) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs similarity index 100% rename from Robust.Shared/GameObjects/Systems/SharedMapSystem.Lookup.cs rename to Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs From 7f9eb72be5cdd39a88e972845d54c1b6f76f13c5 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 22:56:49 -0700 Subject: [PATCH 10/21] Doc comments for new SharedMapSystem methods --- .../Systems/SharedMapSystem.Grid.Queries.cs | 173 ++++++++++++++++-- .../Systems/SharedMapSystem.Grid.cs | 13 ++ 2 files changed, 167 insertions(+), 19 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs index d00cb55ea07..61f2aa75139 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Numerics; @@ -27,6 +28,15 @@ public abstract partial class SharedMapSystem #region TryFindGridAt + /// + /// Attempts to find a grid which overlaps with a given position on a given map. + /// If the map is itself a grid and there is no other grid overlapping with the given position this will return the map itself as such a grid. + /// + /// The uid of the map to search for a valid grid. + /// The exact position within and relative to the map to search for a valid grid. + /// Returns the uid of the grid found, if any. + /// Returns the component of the grid found, if any. + /// True if a grid overlapping with the given position within the given map was found, or false otherwise. public bool TryFindGridAt(EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { var rangeVec = new Vector2(0.2f, 0.2f); @@ -56,12 +66,12 @@ public bool TryFindGridAt(EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, // NOTE: // If you change this to use fixtures instead (i.e. if you want half-tiles) then you need to make sure // you account for the fact that fixtures are shrunk slightly! - var chunkIndices = SharedMapSystem.GetChunkIndices(localPos, iGrid.ChunkSize); + var chunkIndices = GetChunkIndices(localPos, iGrid.ChunkSize); if (!iGrid.Chunks.TryGetValue(chunkIndices, out var chunk)) return true; - var chunkRelative = SharedMapSystem.GetChunkRelative(localPos, iGrid.ChunkSize); + var chunkRelative = GetChunkRelative(localPos, iGrid.ChunkSize); var chunkTile = chunk.GetTile(chunkRelative); if (chunkTile.IsEmpty) @@ -84,6 +94,8 @@ public bool TryFindGridAt(EntityUid mapEnt, Vector2 worldPos, out EntityUid uid, return grid != null; } + /// + /// The id of the map to search for a valid grid. public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { if (TryGetMap(mapId, out var map)) @@ -94,6 +106,8 @@ public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [Not return false; } + /// + /// The map position to search for a valid grid. public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) { return TryFindGridAt(mapCoordinates.MapId, mapCoordinates.Position, out uid, out grid); @@ -103,30 +117,62 @@ public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [Not #region MapId - public void FindGridsIntersecting( + /// + /// Adds every grid on the specified map which intersects the given region to the provided collection. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. + public void FindGridsIntersecting( MapId mapId, - T shape, + TShape shape, Transform transform, ref List> grids, bool approx = Approximate, - bool includeMap = IncludeMap) where T : IPhysShape + bool includeMap = IncludeMap) where TShape : IPhysShape { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, shape, transform, ref grids, approx: approx, includeMap: includeMap); } - public void FindGridsIntersecting( + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. + public void FindGridsIntersecting( MapId mapId, - T shape, + TShape shape, Transform transform, GridCallback callback, bool approx = Approximate, - bool includeMap = IncludeMap) where T : IPhysShape + bool includeMap = IncludeMap) where TShape : IPhysShape { if (TryGetMap(mapId, out var mapEnt)) FindGridsIntersecting(mapEnt.Value, shape, transform, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. + public void FindGridsIntersecting( + MapId mapId, + TShape shape, + Transform transform, + ref TState state, + GridCallback callback, + bool approx = Approximate, + bool includeMap = IncludeMap) where TShape : IPhysShape + { + if (TryGetMap(mapId, out var mapEnt)) + FindGridsIntersecting(mapEnt.Value, shape, transform, ref state, callback, approx: approx, includeMap: includeMap); + } + + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// public void FindGridsIntersecting( MapId mapId, Box2 worldAABB, @@ -138,6 +184,10 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt.Value, worldAABB, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// public void FindGridsIntersecting( MapId mapId, Box2 worldAABB, @@ -150,6 +200,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(map.Value, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); } + /// + /// Adds every grid on the specified map which intersects the given region to the provided collection. + /// public void FindGridsIntersecting( MapId mapId, Box2 worldAABB, @@ -161,6 +214,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(map.Value, worldAABB, ref grids, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// public void FindGridsIntersecting( MapId mapId, Box2Rotated worldBounds, @@ -172,6 +228,10 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt.Value, worldBounds, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// public void FindGridsIntersecting( MapId mapId, Box2Rotated worldBounds, @@ -184,6 +244,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt.Value, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); } + /// + /// Adds every grid on the specified map which intersects the given region to the provided collection. + /// public void FindGridsIntersecting( MapId mapId, Box2Rotated worldBounds, @@ -199,6 +262,11 @@ public void FindGridsIntersecting( #region EntityUid + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. public void FindGridsIntersecting( EntityUid mapEnt, TShape shape, @@ -210,6 +278,12 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. public void FindGridsIntersecting( EntityUid mapEnt, TShape shape, @@ -222,6 +296,27 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref state, callback, approx: approx, includeMap: includeMap); } + /// + /// Adds every grid on the specified map which intersects the given region to the provided list. + /// + /// The shape of the region to check. + /// The transform, relative to the map, of the region to check. + public void FindGridsIntersecting( + EntityUid mapEnt, + TShape shape, + Transform transform, + ref List> grids, + bool approx = Approximate, + bool includeMap = IncludeMap) where TShape : IPhysShape + { + FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref grids, approx: approx, includeMap: includeMap); + } + + /// + /// Adds every grid on the specified map which intersects the given regions to the provided collection. + /// + /// A set of regions to check. + /// The transform, relative to the map, of the regions to check. public void FindGridsIntersecting( EntityUid mapEnt, List shapes, @@ -236,17 +331,9 @@ public void FindGridsIntersecting( } } - public void FindGridsIntersecting( - EntityUid mapEnt, - TShape shape, - Transform transform, - ref List> grids, - bool approx = Approximate, - bool includeMap = IncludeMap) where TShape : IPhysShape - { - FindGridsIntersecting(mapEnt, shape, shape.ComputeAABB(transform, 0), transform, ref grids, approx: approx, includeMap: includeMap); - } - + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2 worldAABB, @@ -258,6 +345,10 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2 worldAABB, @@ -270,6 +361,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); } + /// + /// Adds every grid on the specified map which intersects the given regions to the provided list. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2 worldAABB, @@ -281,6 +375,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, worldAABB, Robust.Shared.Physics.Transform.Empty, ref grids, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2Rotated worldBounds, @@ -292,6 +389,10 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, callback, approx: approx, includeMap: includeMap); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2Rotated worldBounds, @@ -304,6 +405,9 @@ public void FindGridsIntersecting( FindGridsIntersecting(mapEnt, shape, Robust.Shared.Physics.Transform.Empty, ref state, callback, approx: approx, includeMap: includeMap); } + /// + /// Adds every grid on the specified map which intersects the given regions to the provided list. + /// public void FindGridsIntersecting( EntityUid mapEnt, Box2Rotated worldBounds, @@ -317,6 +421,9 @@ public void FindGridsIntersecting( #endregion + /// + /// Enumerates all of the grids located on a given map. + /// public IEnumerable> GetAllGrids(MapId mapId) { var query = AllEntityQuery(); @@ -329,6 +436,11 @@ public IEnumerable> GetAllGrids(MapId mapId) } } + /// + /// This version only provides the component without the uid and should not be used. + /// + /// + [Obsolete("use GetAllGrids instead")] public IEnumerable GetAllMapGrids(MapId mapId) { var query = AllEntityQuery(); @@ -339,6 +451,13 @@ public IEnumerable GetAllMapGrids(MapId mapId) } } + /// + /// Adds every grid on the specified map which intersects the given regions to the provided list. + /// + /// The shape of the region to check. + /// The world-local axis aligned bounding box of the region to check. + /// The transform, relative to the map, of the region to check. + [Access(typeof(IMapManager), Other = AccessPermissions.None)] public void FindGridsIntersecting( EntityUid mapEnt, TShape shape, @@ -359,6 +478,12 @@ public void FindGridsIntersecting( ); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// + /// The shape of the region to check. + /// The world-local axis aligned bounding box of the region to check. + /// The transform, relative to the map, of the region to check. private void FindGridsIntersecting( EntityUid mapEnt, TShape shape, @@ -375,6 +500,13 @@ private void FindGridsIntersecting( ); } + /// + /// Invokes the provided callback on every grid on the specified map which intersect the given region. + /// Allows providing some additional to pass to the callback when it is invoked. + /// + /// The shape of the region to check. + /// The world-local axis aligned bounding box of the region to check. + /// The transform, relative to the map, of the region to check. private void FindGridsIntersecting( EntityUid mapEnt, TShape shape, @@ -434,6 +566,9 @@ private void FindGridsIntersecting( state = gridState.State; } + /// + /// Tests whether any of a collection of grid chunks intersect with a given region. + /// private bool IsIntersecting( ChunkEnumerator enumerator, TShape shape, diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 6de54c1b019..1af4b61baa7 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -23,11 +23,17 @@ public abstract partial class SharedMapSystem { #region CreateGrid + /// + /// Creates a new grid entity on a given map. + /// public Entity CreateGridEntity(MapId mapId, GridCreateOptions? options = null) { return CreateGridEntity(GetMap(mapId), options); } + /// + /// Creates a new grid entity on a given map. + /// public Entity CreateGridEntity(EntityUid mapEnt, GridCreateOptions? options = null) { options ??= GridCreateOptions.Default; @@ -524,6 +530,9 @@ private void GetFullState(EntityUid uid, MapGridComponent component, ref Compone #endif } + /// + /// Prunes tracked grid chunk deletions older than some given game tick. + /// public void CullDeletionHistory(GameTick upToTick) { var query = AllEntityQuery(); @@ -1799,6 +1808,10 @@ public bool MoveNext(out TileRef tile) } } +/// +/// Additional parameters used when creating a new grid entity. +/// +/// The number of tiles long/wide the grids chunks should be. public record struct GridCreateOptions(ushort ChunkSize) { public readonly static GridCreateOptions Default = new(ChunkSize: 16); From e4c6c7a072feaab58fc604c325a9859a83610195 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 22:59:03 -0700 Subject: [PATCH 11/21] Doc comment --- Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 1af4b61baa7..2e4c328a8e7 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -1703,6 +1703,9 @@ private void OnTileModified(EntityUid uid, MapGridComponent grid, MapChunk mapCh } } + /// + /// Raises on the provided grid unless is set. + /// internal void RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk) { if (SuppressOnTileChanged) From 0663a9ba6b9143945bdbe4926207d708cbd17025 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 23:01:15 -0700 Subject: [PATCH 12/21] Doc comments --- Robust.Shared/Map/Commands/MapPausingCommands.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Robust.Shared/Map/Commands/MapPausingCommands.cs b/Robust.Shared/Map/Commands/MapPausingCommands.cs index 6f2a2a80538..2b74ac3c15a 100644 --- a/Robust.Shared/Map/Commands/MapPausingCommands.cs +++ b/Robust.Shared/Map/Commands/MapPausingCommands.cs @@ -5,6 +5,9 @@ namespace Robust.Shared.Map.Commands; +/// +/// Pauses a given map, halting all entity processing on it. +/// public sealed partial class PauseMapCommand : LocalizedEntityCommands { [Dependency] SharedMapSystem _mapSystem = default!; @@ -30,6 +33,9 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) } } +/// +/// Unpauses a given map, resuming all entity processing on it. +/// public sealed partial class UnpauseMapCommand : LocalizedEntityCommands { [Dependency] SharedMapSystem _mapSystem = default!; @@ -55,6 +61,9 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) } } +/// +/// Checks whether a given map is currently paused. +/// public sealed partial class QueryMapPausedCommand : LocalizedEntityCommands { [Dependency] SharedMapSystem _mapSystem = default!; From 633ddcf4f6ea65facfbc839dacab142bd51cd051 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 23:06:50 -0700 Subject: [PATCH 13/21] Fix access --- .../GameObjects/Systems/SharedMapSystem.Grid.Queries.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs index 61f2aa75139..ae3165b0543 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs @@ -457,7 +457,7 @@ public IEnumerable GetAllMapGrids(MapId mapId) /// The shape of the region to check. /// The world-local axis aligned bounding box of the region to check. /// The transform, relative to the map, of the region to check. - [Access(typeof(IMapManager), Other = AccessPermissions.None)] + [Access(typeof(MapManager), Other = AccessPermissions.None)] public void FindGridsIntersecting( EntityUid mapEnt, TShape shape, From 72ff562a83c2112db31a22cdb7877c423fa7f5ac Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 03:06:11 -0700 Subject: [PATCH 14/21] Purge all references to IMapManagerInternal --- .../Systems/SharedGridTraversalSystem.cs | 4 ++-- .../Systems/SharedMapSystem.Coordinates.cs | 2 +- .../GameObjects/Systems/SharedMapSystem.cs | 2 -- .../Physics/Systems/SharedBroadphaseSystem.cs | 13 ++++++------- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs b/Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs index 5cbdd7f6f63..ef0f8f0108c 100644 --- a/Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.GameObjects; /// public sealed partial class SharedGridTraversalSystem : EntitySystem { - [Dependency] private IMapManagerInternal _mapManager = default!; + [Dependency] private SharedMapSystem _mapSystem = default!; [Dependency] private SharedTransformSystem _transform = default!; [Dependency] private IGameTiming _timing = default!; @@ -97,7 +97,7 @@ public void CheckTraversal(EntityUid entity, TransformComponent xform, EntityUid : Vector2.Transform(xform.LocalPosition, Transform(xform.ParentUid).LocalMatrix); // Change parent if necessary - if (_mapManager.TryFindGridAt(map, mapPos, out var gridUid, out _)) + if (_mapSystem.TryFindGridAt(map, mapPos, out var gridUid, out _)) { // Some minor duplication here with AttachParent but only happens when going on/off grid so not a big deal ATM. if (gridUid != xform.GridUid && !TerminatingOrDeleted(gridUid)) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs index 7ff85746be3..de2ad55a9d2 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs @@ -25,7 +25,7 @@ public EntityCoordinates AlignToGrid(EntityCoordinates coordinates) // Check if mappos intersects a grid. var mapPos = _transform.ToMapCoordinates(coordinates); - if (_mapInternal.TryFindGridAt(mapPos, out var gridUid, out gridComponent)) + if (TryFindGridAt(mapPos, out var gridUid, out gridComponent)) { var tile = CoordinatesToTile(gridUid, gridComponent, coordinates); return ToCenterCoordinates(gridUid, tile, gridComponent); diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs index 94486e8077e..9564f3b849a 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs @@ -22,9 +22,7 @@ public abstract partial class SharedMapSystem : EntitySystem { [Dependency] private ITileDefinitionManager _tileMan = default!; [Dependency] private IGameTiming _timing = default!; - [Dependency] protected IMapManager MapManager = default!; [Dependency] private IManifoldManager _manifolds = default!; - [Dependency] private IMapManagerInternal _mapInternal = default!; [Dependency] private INetManager _netManager = default!; [Dependency] private FixtureSystem _fixtures = default!; [Dependency] private SharedPhysicsSystem _physics = default!; diff --git a/Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs b/Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs index e6fbf61f9b2..17d2108adef 100644 --- a/Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs +++ b/Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs @@ -18,7 +18,6 @@ namespace Robust.Shared.Physics.Systems public abstract partial class SharedBroadphaseSystem : EntitySystem { [Dependency] private IConfigurationManager _cfg = default!; - [Dependency] private IMapManagerInternal _mapManager = default!; [Dependency] private IParallelManager _parallel = default!; [Dependency] private EntityLookupSystem _lookup = default!; [Dependency] private SharedGridTraversalSystem _traversal = default!; @@ -51,9 +50,9 @@ public override void Initialize() _contactJob = new() { - MapManager = _mapManager, System = this, TransformSys = EntityManager.System(), + MapSys = _map, // TODO: EntityManager one isn't ready yet? XformQuery = GetEntityQuery(), }; @@ -265,7 +264,7 @@ private void HandleGridCollisions(HashSet movedGrids) _physicsQuery, _xformQuery); - _mapManager.FindGridsIntersecting(xform.MapID, aabb, ref state, + _map.FindGridsIntersecting(xform.MapID, aabb, ref state, static (EntityUid gridBUid, MapGridComponent gridBMapComp, ref (Entity gridA, Transform gridAToWorldRigid, @@ -541,7 +540,7 @@ internal void GetBroadphases(MapId mapId, Box2 aabb, BroadphaseCallback callback if (_broadphaseQuery.TryGetComponent(map.Value, out var mapBroadphase)) callback((map.Value, mapBroadphase)); - _mapManager.FindGridsIntersecting(map.Value, + _map.FindGridsIntersecting(map.Value, aabb, ref internalState, static ( @@ -569,7 +568,7 @@ internal void GetBroadphases(MapId mapId, Box2 aabb, ref TState state, B if (_broadphaseQuery.TryGetComponent(map.Value, out var mapBroadphase)) callback((map.Value, mapBroadphase), ref state); - _mapManager.FindGridsIntersecting(map.Value, + _map.FindGridsIntersecting(map.Value, aabb, ref internalState, static ( @@ -596,7 +595,7 @@ private record struct BroadphaseContactJob() : IParallelRobustJob { public SharedBroadphaseSystem System = default!; public SharedTransformSystem TransformSys = default!; - public IMapManager MapManager = default!; + public SharedMapSystem MapSys = default!; public EntityQuery XformQuery; @@ -626,7 +625,7 @@ public void Execute(int index) var state = (System, proxy, worldAABB, Pairs); // Get every broadphase we may be intersecting. - MapManager.FindGridsIntersecting(mapUid, worldAABB.Enlarged(broadphaseExpand), ref state, + MapSys.FindGridsIntersecting(mapUid, worldAABB.Enlarged(broadphaseExpand), ref state, static (EntityUid uid, MapGridComponent _, ref ( SharedBroadphaseSystem system, FixtureProxy proxy, From 9e184909d70ce7b7c7a6ee3430e07eae6c1b6c24 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 03:57:28 -0700 Subject: [PATCH 15/21] Cull easy IMapManager references --- .../Transform/RecursiveMoveBenchmark.cs | 3 +- Robust.Client/Console/Commands/Debug.cs | 3 +- .../Debugging/DebugAnchoringSystem.cs | 3 +- .../Debugging/Overlays/TileDebugOverlay.cs | 5 ++- .../EntitySystems/DebugLightTreeSystem.cs | 4 -- .../GridChunkBoundsDebugSystem.cs | 6 +-- .../Graphics/Clyde/Clyde.GridRendering.cs | 11 +++-- Robust.Client/Graphics/Clyde/Clyde.cs | 1 - Robust.Client/Physics/GridFixtureSystem.cs | 4 +- .../GameObjects/Components/Transform_Test.cs | 6 +-- .../GameStates/DetachedParentTest.cs | 7 ++- .../GameStates/MissingParentTest.cs | 1 - .../GameStates/PvsChunkTest.cs | 3 +- .../GameStates/PvsReEntryTest.cs | 1 - .../GameStates/PvsSystemTests.cs | 3 +- Robust.Server/Physics/GridFixtureSystem.cs | 3 +- .../EntityLookup_Test.cs | 5 +-- .../AutoIncludeSerializationTest.cs | 3 +- .../EntitySerialization/CategorizationTest.cs | 5 +-- .../EntitySerialization/MapMergeTest.cs | 3 +- .../OrphanSerializationTest.cs | 5 +-- .../GameObjects/ContainerTests.cs | 1 - .../GameObjects/DeferredEntityDeletionTest.cs | 1 - .../Systems/AnchoredSystemTests.cs | 3 +- .../GameObjects/TransformComponent_Tests.cs | 3 +- .../GameState/DeletionNetworkingTests.cs | 5 +-- .../Map/EntityCoordinates_Tests.cs | 1 - .../Map/GridCollision_Test.cs | 5 +-- .../Map/GridContraction_Test.cs | 6 +-- .../Map/GridFixtures_Tests.cs | 5 +-- .../Map/GridMerge_Tests.cs | 9 ++-- .../Map/GridRotation_Tests.cs | 6 +-- .../Map/GridSplit_Tests.cs | 43 ++++++++----------- .../Map/MapGridMap_Tests.cs | 8 ++-- .../Map/MapGrid_Tests.cs | 27 ++++-------- .../Map/MapPauseTests.cs | 6 --- .../Map/Query_Tests.cs | 5 +-- .../Map/SingleTileRemoveTest.cs | 3 +- .../Physics/BroadphaseNetworkingTest.cs | 5 +-- .../Physics/Broadphase_Test.cs | 19 +++----- .../Physics/CollisionWake_Test.cs | 3 +- .../Physics/GridMovement_Test.cs | 3 +- .../Physics/GridReparentVelocity_Test.cs | 4 +- .../Physics/JointDeletion_Test.cs | 1 - .../Physics/RayCast_Test.cs | 2 +- .../Physics/RecursiveUpdateTest.cs | 6 +-- .../Physics/Stack_Test.cs | 1 - .../Prototypes/HotReloadTest.cs | 2 - .../TransformTests/GridTraversalTest.cs | 3 +- .../ComponentTrees/ComponentTreeSystem.cs | 3 +- Robust.Shared/Console/Commands/MapCommands.cs | 3 +- .../Console/Commands/TeleportCommands.cs | 3 +- Robust.Shared/GameObjects/EntityManager.cs | 3 +- .../Systems/EntityLookup.Queries.cs | 8 ++-- .../EntityLookupSystem.ComponentQueries.cs | 6 +-- .../GameObjects/Systems/EntityLookupSystem.cs | 1 - .../SharedTransformSystem.Component.cs | 12 +++--- .../Systems/SharedTransformSystem.cs | 1 - Robust.Shared/Map/CoordinatesExtensions.cs | 4 +- 59 files changed, 114 insertions(+), 201 deletions(-) diff --git a/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs b/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs index 15acf565239..1f67c1a5483 100644 --- a/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs +++ b/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs @@ -47,7 +47,6 @@ public void GlobalSetup() Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()).Wait(); - var mapMan = server.ResolveDependency(); _entMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -92,7 +91,7 @@ public void GlobalSetup() server.WaitPost(() => { var map = server.ResolveDependency().CreateMap(out var mapId); - var gridComp = mapMan.CreateGridEntity(mapId); + var gridComp = mapSys.CreateGridEntity(mapId); var grid = gridComp.Owner; mapSys.SetTile(grid, gridComp, Vector2i.Zero, new Tile(1)); _gridCoords = new EntityCoordinates(grid, .5f, .5f); diff --git a/Robust.Client/Console/Commands/Debug.cs b/Robust.Client/Console/Commands/Debug.cs index 3d8c0ed0a0a..1d21498e123 100644 --- a/Robust.Client/Console/Commands/Debug.cs +++ b/Robust.Client/Console/Commands/Debug.cs @@ -718,7 +718,6 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) internal sealed partial class ChunkInfoCommand : LocalizedEntityCommands { - [Dependency] private IMapManager _map = default!; [Dependency] private IEyeManager _eye = default!; [Dependency] private IInputManager _input = default!; [Dependency] private SharedMapSystem _mapSystem = default!; @@ -729,7 +728,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mousePos = _eye.PixelToMap(_input.MouseScreenPosition); - if (!_map.TryFindGridAt(mousePos, out var gridUid, out var grid)) + if (!_mapSystem.TryFindGridAt(mousePos, out var gridUid, out var grid)) { shell.WriteLine("No grid under your mouse cursor."); return; diff --git a/Robust.Client/Debugging/DebugAnchoringSystem.cs b/Robust.Client/Debugging/DebugAnchoringSystem.cs index 0446aa7b676..75c6d07b7e7 100644 --- a/Robust.Client/Debugging/DebugAnchoringSystem.cs +++ b/Robust.Client/Debugging/DebugAnchoringSystem.cs @@ -17,7 +17,6 @@ public sealed partial class DebugAnchoringSystem : EntitySystem { [Dependency] private IEyeManager _eyeManager = default!; [Dependency] private IInputManager _inputManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IUserInterfaceManager _userInterface = default!; [Dependency] private MapSystem _mapSystem = default!; @@ -64,7 +63,7 @@ public override void FrameUpdate(float frameTime) var mouseSpot = _inputManager.MouseScreenPosition; var spot = _eyeManager.PixelToMap(mouseSpot); - if (!_mapManager.TryFindGridAt(spot, out var gridUid, out var grid)) + if (!_mapSystem.TryFindGridAt(spot, out var gridUid, out var grid)) { _label.Text = string.Empty; _hovered = null; diff --git a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs index 74779c8eccc..b157af2654e 100644 --- a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs +++ b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs @@ -25,6 +25,7 @@ public abstract partial class TileDebugOverlay : Overlay, IPostInjectInit { [Dependency] protected IEntityManager Entity = default!; [Dependency] protected IEyeManager Eye = default!; + [Obsolete("use SharedMapSystem")] [Dependency] protected IMapManager MapMan = default!; [Dependency] protected IInputManager Input = default!; [Dependency] protected IUserInterfaceManager Ui = default!; @@ -59,7 +60,7 @@ protected internal override void Draw(in OverlayDrawArgs args) if (args.Viewport.Eye?.Position.MapId is not {} map || map == MapId.Nullspace) return; - MapMan.FindGridsIntersecting(map, args.WorldBounds, ref Grids); + Map.FindGridsIntersecting(map, args.WorldBounds, ref Grids); foreach (var grid in Grids) { @@ -108,7 +109,7 @@ protected virtual void DrawTooltip(DrawingHandleScreen handle) var coords = viewport.PixelToMap(mousePos.Position); - if (!MapMan.TryFindGridAt(coords, out var grid, out var comp)) + if (!Map.TryFindGridAt(coords, out var grid, out var comp)) return; var local = Map.WorldToLocal(grid, comp, coords.Position); diff --git a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs index cc41a5482ee..4397c4ebeee 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs @@ -46,8 +46,6 @@ public bool Enabled private sealed class DebugLightOverlay : Overlay { private EntityLookupSystem _lookup; - private IEyeManager _eyeManager; - private IMapManager _mapManager; private LightTreeSystem _trees; @@ -56,8 +54,6 @@ private sealed class DebugLightOverlay : Overlay public DebugLightOverlay(EntityLookupSystem lookup, IEyeManager eyeManager, IMapManager mapManager, LightTreeSystem trees) { _lookup = lookup; - _eyeManager = eyeManager; - _mapManager = mapManager; _trees = trees; } diff --git a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs index 1a60f7bd9e7..a0fb7a7430a 100644 --- a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs @@ -58,8 +58,6 @@ public bool Enabled internal sealed class GridChunkBoundsOverlay : Overlay { private readonly IEntityManager _entityManager; - private readonly IEyeManager _eyeManager; - private readonly IMapManager _mapManager; private readonly SharedTransformSystem _transformSystem; private readonly SharedMapSystem _mapSystem; @@ -70,8 +68,6 @@ internal sealed class GridChunkBoundsOverlay : Overlay public GridChunkBoundsOverlay(IEntityManager entManager, IEyeManager eyeManager, IMapManager mapManager, SharedTransformSystem transformSystem, SharedMapSystem mapSystem) { _entityManager = entManager; - _eyeManager = eyeManager; - _mapManager = mapManager; _transformSystem = transformSystem; _mapSystem = mapSystem; } @@ -84,7 +80,7 @@ protected internal override void Draw(in OverlayDrawArgs args) var fixturesQuery = _entityManager.GetEntityQuery(); _grids.Clear(); - _mapManager.FindGridsIntersecting(currentMap, viewport, ref _grids); + _mapSystem.FindGridsIntersecting(currentMap, viewport, ref _grids); foreach (var grid in _grids) { var worldMatrix = _transformSystem.GetWorldMatrix(grid); diff --git a/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs b/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs index 933eb05b774..d47ba808ec6 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs @@ -52,19 +52,18 @@ private void RenderTileEdgesChanges(bool value) private void _drawGrids(Viewport viewport, Box2 worldAABB, Box2Rotated worldBounds, IEye eye) { var mapId = eye.Position.MapId; - if (!_mapManager.MapExists(mapId)) + if (!_mapSystem.MapExists(mapId)) { // fall back to nullspace map mapId = MapId.Nullspace; } _grids.Clear(); - _mapManager.FindGridsIntersecting(mapId, worldBounds, ref _grids); + _mapSystem.FindGridsIntersecting(mapId, worldBounds, ref _grids); var requiresFlush = true; GLShaderProgram gridProgram = default!; var gridOverlays = GetOverlaysForSpace(OverlaySpace.WorldSpaceGrids); - var mapSystem = _entityManager.System(); foreach (var mapGrid in _grids) { @@ -86,7 +85,7 @@ private void _drawGrids(Viewport viewport, Box2 worldAABB, Box2Rotated worldBoun } gridProgram.SetUniform(UniIModelMatrix, _transformSystem.GetWorldMatrix(mapGrid)); - var enumerator = mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); + var enumerator = _mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); // Handle base texture updates. while (enumerator.MoveNext(out var chunk)) @@ -123,7 +122,7 @@ private void _drawGrids(Viewport viewport, Box2 worldAABB, Box2Rotated worldBoun // Handle edge sprites. if (_drawTileEdges) { - enumerator = mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); + enumerator = _mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); while (enumerator.MoveNext(out var chunk)) { var datum = data[chunk.Indices]; @@ -132,7 +131,7 @@ private void _drawGrids(Viewport viewport, Box2 worldAABB, Box2Rotated worldBoun } } - enumerator = mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); + enumerator = _mapSystem.GetMapChunks(mapGrid.Owner, mapGrid.Comp, worldBounds); // Draw chunks while (enumerator.MoveNext(out var chunk)) diff --git a/Robust.Client/Graphics/Clyde/Clyde.cs b/Robust.Client/Graphics/Clyde/Clyde.cs index 03f929c536d..4ac8937bd67 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.cs @@ -37,7 +37,6 @@ internal sealed partial class Clyde : IClydeInternal, IPostInjectInit, IEntityEv [Dependency] private IClydeTileDefinitionManager _tileDefinitionManager = default!; [Dependency] private ILightManager _lightManager = default!; [Dependency] private ILogManager _logManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IOverlayManager _overlayManager = default!; [Dependency] private IResourceCache _resourceCache = default!; [Dependency] private IResourceManager _resManager = default!; diff --git a/Robust.Client/Physics/GridFixtureSystem.cs b/Robust.Client/Physics/GridFixtureSystem.cs index 9907f81ef08..5e995bda220 100644 --- a/Robust.Client/Physics/GridFixtureSystem.cs +++ b/Robust.Client/Physics/GridFixtureSystem.cs @@ -72,14 +72,12 @@ private sealed class GridSplitNodeOverlay : Overlay { public override OverlaySpace Space => OverlaySpace.WorldSpace; - private readonly IMapManager _mapManager; private readonly GridFixtureSystem _system; private readonly SharedTransformSystem _transform; private readonly SharedMapSystem _map; public GridSplitNodeOverlay(IMapManager mapManager, GridFixtureSystem system, SharedTransformSystem transform, SharedMapSystem map) { - _mapManager = mapManager; _system = system; _transform = transform; _map = map; @@ -91,7 +89,7 @@ protected internal override void Draw(in OverlayDrawArgs args) var state = (_system, _transform, args.WorldBounds, worldHandle); - _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds, ref state, + _map.FindGridsIntersecting(args.MapId, args.WorldBounds, ref state, (EntityUid uid, MapGridComponent grid, ref (GridFixtureSystem system, SharedTransformSystem transform, Box2Rotated worldBounds, DrawingHandleWorld worldHandle) tuple) => { diff --git a/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs b/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs index 95b857bb95e..c61bb9a0ed9 100644 --- a/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs +++ b/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs @@ -19,7 +19,6 @@ internal sealed class Transform_Test : RobustUnitTest public override UnitTestProject Project => UnitTestProject.Server; private IEntityManager EntityManager = default!; - private IMapManager MapManager = default!; private SharedTransformSystem XformSystem => EntityManager.System(); const string Prototypes = @" @@ -47,7 +46,6 @@ public void Setup() IoCManager.Resolve().GenerateNetIds(); EntityManager = IoCManager.Resolve(); - MapManager = IoCManager.Resolve(); IoCManager.Resolve().Initialize(); var manager = IoCManager.Resolve(); @@ -60,8 +58,8 @@ public void Setup() mapSys.CreateMap(out MapA); mapSys.CreateMap(out MapB); - GridA = MapManager.CreateGridEntity(MapA); - GridB = MapManager.CreateGridEntity(MapB); + GridA = mapSys.CreateGridEntity(MapA); + GridB = mapSys.CreateGridEntity(MapB); //NOTE: The grids have not moved, so we can assert worldpos == localpos for the test } diff --git a/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs b/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs index 4ea2a2dd9e8..ea70798c356 100644 --- a/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs @@ -29,7 +29,6 @@ public async Task TestDetachedParent() var mapSys = server.System(); var xformSys = server.System(); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -83,7 +82,7 @@ await server.WaitPost(() => map = mapSys.CreateMap(out mapId); - var gridEnt = mapMan.CreateGridEntity(mapId); + var gridEnt = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridEnt.Owner, gridEnt.Comp, Vector2i.Zero, new Tile(1)); gridCoords = new EntityCoordinates(gridEnt, .5f, .5f); mapCoords = new EntityCoordinates(map, 200, 200); @@ -303,7 +302,7 @@ await server.WaitPost(() => await server.WaitPost(() => { map2 = mapSys.CreateMap(out mapId2); - var gridEnt = mapMan.CreateGridEntity(mapId2); + var gridEnt = mapSys.CreateGridEntity(mapId2); mapSys.SetTile(gridEnt.Owner, gridEnt.Comp, Vector2i.Zero, new Tile(1)); var grid2Coords = new EntityCoordinates(gridEnt, .5f, .5f); grid2 = gridEnt.Owner; @@ -384,7 +383,7 @@ await server.WaitPost(() => await server.WaitPost(() => { map3 = mapSys.CreateMap(out mapId3); - var gridEnt = mapMan.CreateGridEntity(mapId3); + var gridEnt = mapSys.CreateGridEntity(mapId3); mapSys.SetTile(gridEnt.Owner, gridEnt.Comp, Vector2i.Zero, new Tile(1)); var grid3Coords = new EntityCoordinates(gridEnt, .5f, .5f); grid3 = gridEnt.Owner; diff --git a/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs b/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs index 470ee32d37e..561e73c770e 100644 --- a/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs @@ -23,7 +23,6 @@ public async Task TestMissingParent() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); diff --git a/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs b/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs index 6e7cb201f78..7f2c48439a9 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs @@ -22,7 +22,6 @@ public async Task TestGridMapChange() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -73,7 +72,7 @@ await server.WaitPost(() => mapCoords = new(map1, default); map2 = server.System().CreateMap(); - var gridComp = mapMan.CreateGridEntity(map2); + var gridComp = mapSys.CreateGridEntity(map2); grid = gridComp.Owner; mapSys.SetTile(grid, gridComp, Vector2i.Zero, new Tile(1)); var gridCoords = new EntityCoordinates(grid, .5f, .5f); diff --git a/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs b/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs index 9ab6e1fa025..25116eba97a 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs @@ -28,7 +28,6 @@ public async Task TestLossyReEntry() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); diff --git a/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs b/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs index 6e4dc30273e..957a8e8384e 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs @@ -25,7 +25,6 @@ public async Task TestMultipleIndexChange() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -52,7 +51,7 @@ public async Task TestMultipleIndexChange() await server.WaitPost(() => { map = server.System().CreateMap(out var mapId); - var gridComp = mapMan.CreateGridEntity(mapId); + var gridComp = maps.CreateGridEntity(mapId); maps.SetTile(gridComp, Vector2i.Zero, new Tile(1)); grid = gridComp.Owner; }); diff --git a/Robust.Server/Physics/GridFixtureSystem.cs b/Robust.Server/Physics/GridFixtureSystem.cs index 873e2e7c31e..159a4ca15c1 100644 --- a/Robust.Server/Physics/GridFixtureSystem.cs +++ b/Robust.Server/Physics/GridFixtureSystem.cs @@ -25,7 +25,6 @@ namespace Robust.Server.Physics /// public sealed partial class GridFixtureSystem : SharedGridFixtureSystem { - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IConfigurationManager _cfg = default!; [Dependency] private IConGroupController _conGroup = default!; [Dependency] private EntityLookupSystem _lookup = default!; @@ -262,7 +261,7 @@ private void CheckSplits(EntityUid uid, HashSet dirtyNodes) for (var i = 0; i < grids.Count - 1; i++) { var group = grids[i]; - var newGrid = _mapManager.CreateGridEntity(mapId); + var newGrid = _maps.CreateGridEntity(mapId); var newGridUid = newGrid.Owner; var newGridXform = _xformQuery.GetComponent(newGridUid); newGrids[i] = newGridUid; diff --git a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs index cd06309a60f..d29062a714c 100644 --- a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs +++ b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs @@ -67,7 +67,7 @@ private EntityUid GetPhysicsEntity(IEntityManager entManager, MapCoordinates spa private Entity SetupGrid(MapId mapId, SharedMapSystem mapSystem, IEntityManager entManager, IMapManager mapManager) { - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); entManager.System().SetLocalPosition(grid.Owner, new Vector2(10f, 10f)); mapSystem.SetTile(grid, Vector2i.Zero, new Tile(1)); return grid; @@ -354,12 +354,11 @@ public void TestAnchoring() var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); var transformSystem = entManager.System(); var mapId = server.CreateMap().MapId; - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var theMapSpotBeingUsed = new Box2(Vector2.Zero, Vector2.One); mapSystem.SetTile(grid, new Vector2i(), new Tile(1)); diff --git a/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs b/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs index 3e4b12c25d4..f049e1dfd37 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs @@ -34,7 +34,6 @@ public async Task TestAutoIncludeSerialization() var entMan = server.EntMan; var mapSys = server.System(); var loader = server.System(); - var mapMan = server.ResolveDependency(); var tileMan = server.ResolveDependency(); var mapPath = new ResPath($"{nameof(AutoIncludeSerializationTest)}_map.yml"); var gridPath = new ResPath($"{nameof(AutoIncludeSerializationTest)}_grid.yml"); @@ -55,7 +54,7 @@ public async Task TestAutoIncludeSerialization() await server.WaitPost(() => { var mapUid = mapSys.CreateMap(out mapId); - var gridUid = mapMan.CreateGridEntity(mapId); + var gridUid = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridUid, Vector2i.Zero, new Tile(tDef.TileId)); var onGridUid = entMan.SpawnEntity(null, new EntityCoordinates(gridUid, 0.5f, 0.5f)); diff --git a/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs b/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs index 5b48ec6c1e6..aee367cbd32 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs @@ -35,7 +35,6 @@ public async Task TestCategorization() var meta = server.System(); var mapSys = server.System(); var loader = server.System(); - var mapMan = server.ResolveDependency(); var tileMan = server.ResolveDependency(); var path = new ResPath($"{nameof(TestCategorization)}.yml"); @@ -56,8 +55,8 @@ await server.WaitPost(() => { mapA = mapSys.CreateMap(out var mapIdA); mapB = mapSys.CreateMap(out var mapIdB); - var gridEntA = mapMan.CreateGridEntity(mapIdA); - var gridEntB = mapMan.CreateGridEntity(mapIdB); + var gridEntA = mapSys.CreateGridEntity(mapIdA); + var gridEntB = mapSys.CreateGridEntity(mapIdB); mapSys.SetTile(gridEntA, Vector2i.Zero, new Tile(tDef.TileId)); mapSys.SetTile(gridEntB, Vector2i.Zero, new Tile(tDef.TileId)); gridA = gridEntA.Owner; diff --git a/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs b/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs index 97f2d94202f..aad38625cf4 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs @@ -35,7 +35,6 @@ public async Task TestMapMerge() var entMan = server.EntMan; var mapSys = server.System(); var loader = server.System(); - var mapMan = server.ResolveDependency(); var tileMan = server.ResolveDependency(); var mapPath = new ResPath($"{nameof(TestMapMerge)}_map.yml"); @@ -52,7 +51,7 @@ public async Task TestMapMerge() await server.WaitPost(() => { var mapUid = mapSys.CreateMap(out mapId, runMapInit: false); - var gridEnt = mapMan.CreateGridEntity(mapId); + var gridEnt = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridEnt, Vector2i.Zero, new Tile(tDef.TileId)); var entUid = entMan.SpawnEntity(null, new MapCoordinates(10, 10, mapId)); map = Get(mapUid, entMan); diff --git a/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs b/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs index 2cbb7f1db82..518abaf559f 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs @@ -129,7 +129,6 @@ public async Task TestOrphanedGridSerialization() var mapSys = server.System(); var loader = server.System(); var xform = server.System(); - var mapMan = server.ResolveDependency(); var tileMan = server.ResolveDependency(); var pathA = new ResPath($"{nameof(TestOrphanedGridSerialization)}_A.yml"); var pathB = new ResPath($"{nameof(TestOrphanedGridSerialization)}_B.yml"); @@ -150,12 +149,12 @@ await server.WaitPost(() => var mapUid = mapSys.CreateMap(out mapId); map = Get(mapUid, entMan); - var gridAUid = mapMan.CreateGridEntity(mapId); + var gridAUid = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridAUid, Vector2i.Zero, new Tile(tDef.TileId)); gridA = Get(gridAUid, entMan); xform.SetLocalPosition(gridA.Owner, new(100, 100)); - var gridBUid = mapMan.CreateGridEntity(mapId); + var gridBUid = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridBUid, Vector2i.Zero, new Tile(tDef.TileId)); gridB = Get(gridBUid, entMan); diff --git a/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs b/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs index 28b38f3f78b..8b52fba8d78 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs @@ -161,7 +161,6 @@ public async Task TestContainerExpectedEntityDeleted() var clientTime = client.ResolveDependency(); var clientNetManager = client.ResolveDependency(); - var sMapManager = server.ResolveDependency(); var sEntManager = server.ResolveDependency(); var sPlayerManager = server.ResolveDependency(); var serverTime = server.ResolveDependency(); diff --git a/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs b/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs index 5bb02e61d2c..1b354c9d81c 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs @@ -39,7 +39,6 @@ public async Task TestDeferredEntityDeletion() await server.WaitAssertion(() => { - var mapMan = IoCManager.Resolve(); entMan = IoCManager.Resolve(); var sys = entMan.EntitySysManager.GetEntitySystem(); diff --git a/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs b/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs index 9f04c1f2d55..0f6ab766eb1 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs @@ -160,9 +160,8 @@ public void OnInitAnchored_AddedToLookup() var mapSys = sim.System(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); var mapId = sim.CreateMap().MapId; - var grid = mapMan.CreateGridEntity(mapId); + var grid = mapSys.CreateGridEntity(mapId); var coordinates = new MapCoordinates(new Vector2(7, 7), mapId); var pos = mapSys.TileIndicesFor(grid, coordinates); mapSys.SetTile(grid, pos, new Tile(1)); diff --git a/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs b/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs index aeb951a1155..01f0559e625 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs @@ -54,12 +54,11 @@ public void AttachToGridOrMap() var server = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); var xformSystem = entManager.System(); mapSystem.CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); mapSystem.SetTile(grid, new Vector2i(0, 0), new Tile(1)); xformSystem.SetLocalPosition(grid, new Vector2(0f, 100f)); diff --git a/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs b/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs index 48b050625d0..86c4de18a61 100644 --- a/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs +++ b/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs @@ -28,7 +28,6 @@ public async Task DeletionNetworkingTest() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var cEntMan = client.ResolveDependency(); var netMan = client.ResolveDependency(); @@ -61,13 +60,13 @@ async Task RunTicks() await server.WaitPost(() => { mapSys.CreateMap(out var mapId); - var gridComp = mapMan.CreateGridEntity(mapId); + var gridComp = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridComp, Vector2i.Zero, new Tile(1)); grid1 = gridComp.Owner; xformSys.SetLocalPosition(grid1, new Vector2(-2,0)); grid1Net = sEntMan.GetNetEntity(grid1); - gridComp = mapMan.CreateGridEntity(mapId); + gridComp = mapSys.CreateGridEntity(mapId); mapSys.SetTile(gridComp, Vector2i.Zero, new Tile(1)); grid2 = gridComp.Owner; xformSys.SetLocalPosition(grid2, new Vector2(2,0)); diff --git a/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs b/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs index f43ccb44fcd..4858f405e33 100644 --- a/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs @@ -46,7 +46,6 @@ public void IsValid_InvalidEntId_False() public void IsValid_EntityDeleted_False() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); var mapEntity = entityManager.System().CreateMap(out var mapId); var newEnt = entityManager.CreateEntityUninitialized(null, new MapCoordinates(Vector2.Zero, mapId)); diff --git a/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs b/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs index b3726f19964..f2c6294ef17 100644 --- a/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs +++ b/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs @@ -19,7 +19,6 @@ public async Task TestGridsCollide() await server.WaitIdleAsync(); - var mapManager = server.ResolveDependency(); var entManager = server.ResolveDependency(); var physSystem = server.ResolveDependency().GetEntitySystem(); var mapSystem = server.ResolveDependency().GetEntitySystem(); @@ -35,8 +34,8 @@ public async Task TestGridsCollide() await server.WaitPost(() => { entManager.System().CreateMap(out mapId); - gridId1 = mapManager.CreateGridEntity(mapId); - gridId2 = mapManager.CreateGridEntity(mapId); + gridId1 = mapSystem.CreateGridEntity(mapId); + gridId2 = mapSystem.CreateGridEntity(mapId); gridEnt1 = gridId1.Value.Owner; gridEnt2 = gridId2.Value.Owner; physics1 = entManager.GetComponent(gridEnt1.Value); diff --git a/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs b/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs index a2eb87253f6..3256bd6abd6 100644 --- a/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs +++ b/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs @@ -17,13 +17,12 @@ public async Task TestGridDeletes() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var mapSystem = entManager.EntitySysManager.GetEntitySystem(); await server.WaitAssertion(() => { entManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEntity = grid.Owner; for (var i = 0; i < 10; i++) @@ -56,13 +55,12 @@ public async Task TestGridNoDeletes() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var mapSystem = entManager.System(); await server.WaitAssertion(() => { entManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); for (var i = 0; i < 10; i++) { diff --git a/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs b/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs index f7374c83b6e..34c12cd20b1 100644 --- a/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs @@ -29,8 +29,8 @@ public void TestGridFixtureDeletion() var server = RobustServerSimulation.NewSimulation().InitializeInstance(); var map = server.CreateMap(); var entManager = server.Resolve(); - var grid = server.Resolve().CreateGridEntity(map.MapId); var mapSystem = entManager.System(); + var grid = mapSystem.CreateGridEntity(map.MapId); var fixtures = entManager.GetComponent(grid); mapSystem.SetTiles(grid, new List<(Vector2i GridIndices, Tile Tile)>() @@ -57,14 +57,13 @@ public async Task TestGridFixtures() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var physSystem = server.ResolveDependency().GetEntitySystem(); var mapSystem = entManager.EntitySysManager.GetEntitySystem(); await server.WaitAssertion(() => { entManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); // Should be nothing if grid empty Assert.That(entManager.TryGetComponent(grid, out PhysicsComponent? gridBody)); diff --git a/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs b/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs index 0ff7aa9c4c9..fc70be68010 100644 --- a/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs @@ -40,14 +40,13 @@ private ISimulation GetSim() public void Merge(Vector2i offset, Angle angle, Box2 bounds) { var sim = GetSim(); - var mapManager = sim.Resolve(); var entMan = sim.Resolve(); var mapSystem = entMan.System(); var gridFixtures = entMan.System(); var mapId = sim.CreateMap().MapId; - var grid1 = mapManager.CreateGridEntity(mapId); - var grid2 = mapManager.CreateGridEntity(mapId); + var grid1 = mapSystem.CreateGridEntity(mapId); + var grid2 = mapSystem.CreateGridEntity(mapId); var tiles = new List<(Vector2i, Tile)>(); for (var y = 0; y < 3; y++) @@ -58,11 +57,11 @@ public void Merge(Vector2i offset, Angle angle, Box2 bounds) mapSystem.SetTiles(grid1, tiles); mapSystem.SetTiles(grid2, tiles); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(2)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(2)); gridFixtures.Merge(grid1.Owner, grid2.Owner, offset, angle, grid1.Comp, grid2.Comp); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); Assert.That(grid1.Comp.LocalAABB, Is.EqualTo(bounds)); } diff --git a/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs b/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs index d73e86ff9b2..c3ca74f10e5 100644 --- a/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs @@ -24,14 +24,13 @@ public async Task TestLocalWorldConversions() await server.WaitIdleAsync(); var entMan = server.ResolveDependency(); - var mapMan = server.ResolveDependency(); var mapSystem = entMan.System(); var transformSystem = entMan.System(); await server.WaitAssertion(() => { mapSystem.CreateMap(out var mapId); - var grid = mapMan.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var coordinates = new EntityCoordinates(gridEnt, new Vector2(10, 0)); @@ -65,13 +64,12 @@ public async Task TestChunkRotations() await server.WaitIdleAsync(); var entMan = server.ResolveDependency(); - var mapMan = server.ResolveDependency(); var mapSystem = entMan.System(); await server.WaitAssertion(() => { mapSystem.CreateMap(out var mapId); - var grid = mapMan.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; /* Test for map chunk rotations */ diff --git a/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs b/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs index 447c4ea9473..beca059b306 100644 --- a/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs @@ -31,11 +31,10 @@ private ISimulation GetSim() public void NoSplit() { var sim = GetSim(); - var mapManager = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; - var gridEnt = mapManager.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); var grid = gridEnt.Comp; grid.CanSplit = false; @@ -44,14 +43,14 @@ public void NoSplit() mapSystem.SetTile(gridEnt, new Vector2i(x, 0), new Tile(1)); } - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, new Vector2i(1, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); grid.CanSplit = true; mapSystem.SetTile(gridEnt, new Vector2i(2, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(2)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(2)); mapSystem.DeleteMap(mapId); } @@ -60,20 +59,19 @@ public void NoSplit() public void SimpleSplit() { var sim = GetSim(); - var mapManager = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; - var gridEnt = mapManager.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); for (var x = 0; x < 3; x++) { mapSystem.SetTile(gridEnt, new Vector2i(x, 0), new Tile(1)); } - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, new Vector2i(1, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(2)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(2)); mapSystem.DeleteMap(mapId); } @@ -82,10 +80,9 @@ public void SimpleSplit() public void DonutSplit() { var sim = GetSim(); - var mapManager = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; - var gridEnt = mapManager.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); for (var x = 0; x < 3; x++) { @@ -95,16 +92,16 @@ public void DonutSplit() } } - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, Vector2i.One, Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, new Vector2i(1, 2), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, new Vector2i(1, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(2)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(2)); mapSystem.DeleteMap(mapId); } @@ -113,10 +110,9 @@ public void DonutSplit() public void TriSplit() { var sim = GetSim(); - var mapManager = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; - var gridEnt = mapManager.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); for (var x = 0; x < 3; x++) { @@ -125,10 +121,10 @@ public void TriSplit() mapSystem.SetTile(gridEnt, Vector2i.One, new Tile(1)); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); mapSystem.SetTile(gridEnt, new Vector2i(1, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(3)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(3)); mapSystem.DeleteMap(mapId); } @@ -141,11 +137,10 @@ public void ReparentSplit() { var sim = GetSim(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSystem = sim.Resolve().System(); var transformSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; - var gridEnt = mapManager.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); var grid = gridEnt.Comp; for (var x = 0; x < 4; x++) @@ -153,7 +148,7 @@ public void ReparentSplit() mapSystem.SetTile(gridEnt, new Vector2i(x, 0), new Tile(1)); } - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(1)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(1)); var dummy = entManager.SpawnEntity(null, new EntityCoordinates(gridEnt, new Vector2(3.5f, 0.5f))); var dummyXform = entManager.GetComponent(dummy); @@ -164,9 +159,9 @@ public void ReparentSplit() Assert.That(anchoredXform.Anchored); mapSystem.SetTile(gridEnt, new Vector2i(2, 0), Tile.Empty); - Assert.That(mapManager.GetAllGrids(mapId).Count(), Is.EqualTo(2)); + Assert.That(mapSystem.GetAllGrids(mapId).Count(), Is.EqualTo(2)); - var newGrid = mapManager.GetAllGrids(mapId).First(x => x.Comp != grid); + var newGrid = mapSystem.GetAllGrids(mapId).First(x => x.Comp != grid); var newGridXform = entManager.GetComponent(newGrid.Owner); Assert.Multiple(() => diff --git a/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs b/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs index 7c6fef1c58f..782cb987de2 100644 --- a/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs @@ -21,16 +21,15 @@ public void FindGrids() var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSystem = entManager.System(); var mapId = sim.CreateMap().MapId; List> grids = []; - mapManager.FindGridsIntersecting(mapId, Box2.UnitCentered, ref grids); + mapSystem.FindGridsIntersecting(mapId, Box2.UnitCentered, ref grids); Assert.That(grids, Is.Empty); entManager.AddComponent(mapSystem.GetMapOrInvalid(mapId)); - mapManager.FindGridsIntersecting(mapId, Box2.UnitCentered, ref grids); + mapSystem.FindGridsIntersecting(mapId, Box2.UnitCentered, ref grids); Assert.That(grids, Has.Count.EqualTo(1)); } @@ -43,11 +42,10 @@ public void AddGridCompToMap() var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSystem = entManager.System(); var mapId = sim.CreateMap().MapId; - mapManager.CreateGridEntity(mapId); + mapSystem.CreateGridEntity(mapId); Assert.DoesNotThrow(() => { diff --git a/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs b/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs index 1ba57f5825e..0aea19113e2 100644 --- a/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs @@ -30,12 +30,11 @@ private static ISimulation SimulationFactory() public void GetTileRefCoords() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); mapSystem.SetTile(grid, new Vector2i(-9, -1), new Tile(typeId: 1, flags: 1, variant: 1)); var result = mapSystem.GetTileRef(grid.Owner, grid.Comp, new Vector2i(-9, -1)); @@ -52,13 +51,12 @@ public void GetTileRefCoords() public void BoundsExpansion() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var transformSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); transformSystem.SetWorldPosition(grid, new Vector2(3, 5)); mapSystem.SetTile(grid, new Vector2i(-1, -2), new Tile(1)); @@ -80,13 +78,12 @@ public void BoundsExpansion() public void BoundsContract() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var transformSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); transformSystem.SetWorldPosition(grid, new Vector2(3, 5)); @@ -108,12 +105,11 @@ public void BoundsContract() public void GridTileToChunkIndices() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); var result = mapSystem.GridTileToChunkIndices(grid.Comp, new Vector2i(-9, -1)); @@ -127,12 +123,11 @@ public void GridTileToChunkIndices() public void ToLocalCentered() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); var result = mapSystem.GridTileToLocal(grid.Owner, grid.Comp, new Vector2i(0, 0)).Position; @@ -144,12 +139,11 @@ public void ToLocalCentered() public void TryGetTileRefNoTile() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); var foundTile = mapSystem.TryGetTileRef(grid.Owner, grid.Comp, new Vector2i(-9, -1), out var tileRef) ; @@ -162,12 +156,11 @@ public void TryGetTileRefNoTile() public void TryGetTileRefTileExists() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); mapSystem.SetTile(grid, new Vector2i(-9, -1), new Tile(typeId: 1, flags: 1, variant: 1)); @@ -183,12 +176,11 @@ public void TryGetTileRefTileExists() public void PointCollidesWithGrid() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); mapSystem.SetTile(grid, new Vector2i(19, 23), new Tile(1)); @@ -201,12 +193,11 @@ public void PointCollidesWithGrid() public void PointNotCollideWithGrid() { var sim = SimulationFactory(); - var mapMan = sim.Resolve(); var mapSystem = sim.Resolve().System(); var mapId = sim.CreateMap().MapId; var gridOptions = new GridCreateOptions(); gridOptions.ChunkSize = 8; - var grid = mapMan.CreateGridEntity(mapId, gridOptions); + var grid = mapSystem.CreateGridEntity(mapId, gridOptions); mapSystem.SetTile(grid, new Vector2i(19, 23), new Tile(1)); diff --git a/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs index 3627df9311b..b66f645bff6 100644 --- a/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs @@ -26,7 +26,6 @@ public void Paused_NotIncluded_NotInQuery() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -47,7 +46,6 @@ public void UnPaused_NotIncluded_InQuery() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -68,7 +66,6 @@ public void Paused_Included_InQuery() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -89,7 +86,6 @@ public void Paused_AddEntity_IsPaused() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -108,7 +104,6 @@ public void UnPaused_AddEntity_IsNotPaused() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -219,7 +214,6 @@ public void Unpaused_PauseMap_PausedEntities() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); var mapId = sim.CreateMap().Uid; entMan.System().SetPaused(mapId, false); diff --git a/Robust.Shared.IntegrationTests/Map/Query_Tests.cs b/Robust.Shared.IntegrationTests/Map/Query_Tests.cs index ed6b1f369ea..1686c5ceb54 100644 --- a/Robust.Shared.IntegrationTests/Map/Query_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/Query_Tests.cs @@ -57,12 +57,11 @@ public void TestBox2GridIntersection(Vector2 position, float radians, Box2 world var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSystem = entManager.System(); var xformSystem = entManager.System(); var map = mapSystem.CreateMap(); - var grid = mapManager.CreateGridEntity(map); + var grid = mapSystem.CreateGridEntity(map); for (var i = 0; i < 10; i++) { @@ -72,7 +71,7 @@ public void TestBox2GridIntersection(Vector2 position, float radians, Box2 world xformSystem.SetWorldRotation(grid.Owner, radians); var grids = new List>(); - mapManager.FindGridsIntersecting(map, worldAABB, ref grids); + mapSystem.FindGridsIntersecting(map, worldAABB, ref grids); Assert.That(grids.Count > 0, Is.EqualTo(result)); } diff --git a/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs b/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs index ada8ffa7d49..6ceda8406f9 100644 --- a/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs +++ b/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs @@ -28,7 +28,6 @@ public async Task TestRemoveSingleTile() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -74,7 +73,7 @@ public async Task TestRemoveSingleTile() await server.WaitPost(() => { sMap = sys.CreateMap(out var mapId); - var comp = mapMan.CreateGridEntity(mapId); + var comp = sys.CreateGridEntity(mapId); grid = (comp.Owner, comp); sys.SetTile(grid, grid, new Vector2i(0, 0), new Tile(typeId: 1, flags: 1, variant: 1)); var coords = new EntityCoordinates(grid, 0.5f, 0.5f); diff --git a/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs b/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs index db24213e235..026d64066a1 100644 --- a/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs +++ b/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs @@ -33,7 +33,6 @@ public async Task TestBroadphaseNetworking() await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var cEntMan = client.ResolveDependency(); var netMan = client.ResolveDependency(); @@ -60,7 +59,7 @@ public async Task TestBroadphaseNetworking() await server.WaitPost(() => { map1 = mapSystem.CreateMap(out var mapId); - var gridEnt = mapMan.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); mapSystem.SetTile(gridEnt, Vector2i.Zero, new Tile(1)); grid1 = gridEnt.Owner; }); @@ -130,7 +129,7 @@ await server.WaitPost(() => { // Create grid map2 = mapSystem.CreateMap(out var mapId); - var gridEnt = mapMan.CreateGridEntity(mapId); + var gridEnt = mapSystem.CreateGridEntity(mapId); mapSystem.SetTile(gridEnt, Vector2i.Zero, new Tile(1)); grid2 = gridEnt.Owner; diff --git a/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs b/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs index cb87f2dbaab..2f90b231d25 100644 --- a/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs @@ -77,12 +77,11 @@ public void ReparentSundries() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSys = entManager.System(); var xformSys = entManager.System(); var (mapEnt, mapId) = sim.CreateMap(); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSys.CreateGridEntity(mapId); mapSys.SetTile(grid, Vector2i.Zero, new Tile(1)); Assert.That(entManager.HasComponent(grid)); @@ -111,14 +110,13 @@ public void ReparentBroadphase() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var fixturesSystem = entManager.EntitySysManager.GetEntitySystem(); var physicsSystem = entManager.EntitySysManager.GetEntitySystem(); var mapSys = entManager.System(); var xformSys = entManager.System(); var (mapEnt, mapId) = sim.CreateMap(); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSys.CreateGridEntity(mapId); var gridUid = grid.Owner; mapSys.SetTile(grid, Vector2i.Zero, new Tile(1)); @@ -163,13 +161,12 @@ public void GridMapUpdate() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSys = entManager.System(); var xformSys = entManager.System(); var (map1, mapId1) = sim.CreateMap(); var (map2, _) = sim.CreateMap(); - var grid = mapManager.CreateGridEntity(mapId1); + var grid = mapSys.CreateGridEntity(mapId1); mapSys.SetTile(grid, Vector2i.Zero, new Tile(1)); var mapBroadphase1 = entManager.GetComponent(map1); @@ -194,14 +191,13 @@ public void BroadphaseRecursiveUpdate() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var system = entManager.EntitySysManager; var physicsSystem = system.GetEntitySystem(); var lookup = system.GetEntitySystem(); var mapSys = entManager.System(); var (map, mapId) = sim.CreateMap(); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSys.CreateGridEntity(mapId); mapSys.SetTile(grid, Vector2i.Zero, new Tile(1)); var gridBroadphase = entManager.GetComponent(grid); @@ -244,7 +240,6 @@ public void EntMapChangeRecursiveUpdate() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var system = entManager.EntitySysManager; var lookup = system.GetEntitySystem(); var xforms = system.GetEntitySystem(); @@ -257,9 +252,9 @@ public void EntMapChangeRecursiveUpdate() var (mapB, mapBId) = sim.CreateMap(); // setup grids - var gridAComp = mapManager.CreateGridEntity(mapAId); - var gridBComp = mapManager.CreateGridEntity(mapBId); - var gridCComp = mapManager.CreateGridEntity(mapAId); + var gridAComp = mapSys.CreateGridEntity(mapAId); + var gridBComp = mapSys.CreateGridEntity(mapBId); + var gridCComp = mapSys.CreateGridEntity(mapAId); var gridA = gridAComp.Owner; var gridB = gridBComp.Owner; var gridC = gridCComp.Owner; diff --git a/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs b/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs index a4109827a8d..65b824afc7f 100644 --- a/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs @@ -41,7 +41,6 @@ public async Task TestCollisionWakeGrid() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var mapSystem = entManager.System(); var transformSystem = entManager.System(); @@ -56,7 +55,7 @@ public async Task TestCollisionWakeGrid() await server.WaitPost(() => { mapSystem.CreateMap(out mapId); - grid = mapManager.CreateGridEntity(mapId); + grid = mapSystem.CreateGridEntity(mapId); mapSystem.SetTile(grid, Vector2i.Zero, new Tile(1)); entityOne = entManager.SpawnEntity("CollisionWakeTestItem", new MapCoordinates(Vector2.One * 2f, mapId)); diff --git a/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs b/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs index 692fad565df..6f6601c8955 100644 --- a/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs @@ -25,7 +25,6 @@ public async Task TestFindGridContacts() // Checks that FindGridContacts succesfully overlaps a grid + map broadphase physics body var systems = server.ResolveDependency(); var fixtureSystem = systems.GetEntitySystem(); - var mapManager = server.ResolveDependency(); var entManager = server.ResolveDependency(); var physSystem = systems.GetEntitySystem(); var transformSystem = entManager.EntitySysManager.GetEntitySystem(); @@ -34,7 +33,7 @@ public async Task TestFindGridContacts() await server.WaitAssertion(() => { entManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); // Setup 1 body on grid, 1 body off grid, and assert that it's all gucci. mapSystem.SetTile(grid, Vector2i.Zero, new Tile(1)); diff --git a/Robust.Shared.IntegrationTests/Physics/GridReparentVelocity_Test.cs b/Robust.Shared.IntegrationTests/Physics/GridReparentVelocity_Test.cs index a8c2d11f2c2..7c8bcf9cbde 100644 --- a/Robust.Shared.IntegrationTests/Physics/GridReparentVelocity_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/GridReparentVelocity_Test.cs @@ -19,7 +19,6 @@ internal sealed class GridReparentVelocity_Test private ISimulation _sim = default!; private IEntitySystemManager _systems = default!; private IEntityManager _entManager = default!; - private IMapManager _mapManager = default!; private FixtureSystem _fixtureSystem = default!; private SharedMapSystem _mapSystem = default!; private SharedPhysicsSystem _physSystem = default!; @@ -38,7 +37,6 @@ public void FixtureSetup() _systems = _sim.Resolve(); _entManager = _sim.Resolve(); - _mapManager = _sim.Resolve(); _fixtureSystem = _systems.GetEntitySystem(); _mapSystem = _systems.GetEntitySystem(); _physSystem = _systems.GetEntitySystem(); @@ -50,7 +48,7 @@ public void Setup() _mapUid = _mapSystem.CreateMap(out _mapId); // Spawn a 1x1 grid centered at (0.5, 0.5), ensure it's movable and its velocity has no damping. - var gridEnt = _mapManager.CreateGridEntity(_mapId); + var gridEnt = _mapSystem.CreateGridEntity(_mapId); var gridPhys = _entManager.GetComponent(gridEnt); _physSystem.SetSleepingAllowed(gridEnt, gridPhys, false); _physSystem.SetBodyType(gridEnt, BodyType.Dynamic, body: gridPhys); diff --git a/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs b/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs index e7ebeb642dd..97631aa532f 100644 --- a/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs @@ -23,7 +23,6 @@ public async Task JointDeletionTest() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var susManager = server.ResolveDependency(); var jointSystem = susManager.GetEntitySystem(); var broadphase = susManager.GetEntitySystem(); diff --git a/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs b/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs index 1672d94c3ec..ee531eb2163 100644 --- a/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs @@ -120,7 +120,7 @@ private void Setup(ISimulation sim, out MapId mapId) sim.System().CreateMap(out mapId); - var grid = sim.Resolve().CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); for (var i = 0; i < 3; i++) { diff --git a/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs b/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs index 4b061376888..10781409e90 100644 --- a/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs +++ b/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs @@ -21,13 +21,12 @@ public void ContainerRecursiveUpdateTest() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var xforms = entManager.System(); var mapSystem = entManager.System(); var containers = entManager.System(); var mapId = sim.CreateMap().MapId; - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var guid = grid.Owner; mapSystem.SetTile(grid, Vector2i.Zero, new Tile(1)); Assert.That(entManager.HasComponent(guid)); @@ -161,7 +160,6 @@ public void RecursiveMoveTest() { var sim = RobustServerSimulation.NewSimulation().InitializeInstance(); var entManager = sim.Resolve(); - var mapManager = sim.Resolve(); var mapSystem = entManager.EntitySysManager.GetEntitySystem(); var transforms = entManager.EntitySysManager.GetEntitySystem(); var lookup = entManager.EntitySysManager.GetEntitySystem(); @@ -216,7 +214,7 @@ public void RecursiveMoveTest() Assert.That(ents, Does.Contain(child)); // Try again, but this time with a parent change. - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var guid = grid.Owner; mapSystem.SetTile(grid, Vector2i.Zero, new Tile(1)); var gridBroadphase = entManager.GetComponent(guid); diff --git a/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs b/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs index eb90f663401..568aeb28251 100644 --- a/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs @@ -155,7 +155,6 @@ public async Task TestCircleStack() await server.WaitIdleAsync(); var entityManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var entitySystemManager = server.ResolveDependency(); var fixtureSystem = entitySystemManager.GetEntitySystem(); var physSystem = entitySystemManager.GetEntitySystem(); diff --git a/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs b/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs index 22fa7147303..713ee695edf 100644 --- a/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs +++ b/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs @@ -34,7 +34,6 @@ internal sealed class HotReloadTest : OurRobustUnitTest - type: {HotReloadTestComponentTwoId}"; private PrototypeManager _prototypes = default!; - private IMapManager _maps = default!; private IEntityManager _entities = default!; protected override Type[]? ExtraComponents => new[] {typeof(HotReloadTestOneComponent), typeof(HotReloadTestTwoComponent)}; @@ -48,7 +47,6 @@ public void Setup() _prototypes.LoadString(InitialPrototypes); _prototypes.ResolveResults(); - _maps = IoCManager.Resolve(); _entities = IoCManager.Resolve(); } diff --git a/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs b/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs index 92401b30d83..eac38f87795 100644 --- a/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs +++ b/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs @@ -16,7 +16,6 @@ public async Task TestSpawnTraversal() var server = StartServer(); await server.WaitIdleAsync(); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var xforms = sEntMan.System(); var mapSys = sEntMan.System(); @@ -29,7 +28,7 @@ public async Task TestSpawnTraversal() await server.WaitPost(() => { map = sEntMan.System().CreateMap(out mapId); - var gridComp = mapMan.CreateGridEntity(mapId); + var gridComp = mapSys.CreateGridEntity(mapId); grid = gridComp.Owner; mapSys.SetTile(grid, gridComp, Vector2i.Zero, new Tile(1)); var gridCentre = new EntityCoordinates(grid, .5f, .5f); diff --git a/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs b/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs index ded59959fe0..8bc7eda7148 100644 --- a/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs +++ b/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs @@ -25,7 +25,6 @@ public abstract partial class ComponentTreeSystem : EntitySyst { [Dependency] private RecursiveMoveSystem _recursiveMoveSys = default!; [Dependency] protected SharedTransformSystem XformSystem = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private SharedMapSystem _mapSystem = default!; private readonly Queue> _updateQueue = new(); @@ -312,7 +311,7 @@ protected virtual Box2 ExtractAabb(in ComponentTreeEntry entry) var state = (EntityManager, trees); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _mapSystem.FindGridsIntersecting(mapId, worldAABB, ref state, (EntityUid uid, MapGridComponent grid, ref (EntityManager EntityManager, ValueList<(EntityUid, TTreeComp)> trees) tuple) => { diff --git a/Robust.Shared/Console/Commands/MapCommands.cs b/Robust.Shared/Console/Commands/MapCommands.cs index 1c679f414f3..58eb49de4d4 100644 --- a/Robust.Shared/Console/Commands/MapCommands.cs +++ b/Robust.Shared/Console/Commands/MapCommands.cs @@ -157,7 +157,6 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) internal sealed partial class ListMapsCommand : LocalizedEntityCommands { [Dependency] private IEntityManager _entManager = default!; - [Dependency] private IMapManager _map = default!; [Dependency] private SharedMapSystem _mapSystem = default!; public override string Command => "lsmap"; @@ -180,7 +179,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) _mapSystem.IsInitialized(mapUid), _mapSystem.IsPaused(mapId), _entManager.GetNetEntity(mapUid), - string.Join(",", _map.GetAllGrids(mapId).Select(grid => grid.Owner))); + string.Join(",", _mapSystem.GetAllGrids(mapId).Select(grid => grid.Owner))); } // Trim the newline diff --git a/Robust.Shared/Console/Commands/TeleportCommands.cs b/Robust.Shared/Console/Commands/TeleportCommands.cs index c028ae2a897..e7e5fd8d447 100644 --- a/Robust.Shared/Console/Commands/TeleportCommands.cs +++ b/Robust.Shared/Console/Commands/TeleportCommands.cs @@ -17,7 +17,6 @@ namespace Robust.Shared.Console.Commands; internal sealed partial class TeleportCommand : LocalizedEntityCommands { - [Dependency] private IMapManager _map = default!; [Dependency] private IEntityManager _entityManager = default!; [Dependency] private SharedTransformSystem _transform = default!; [Dependency] private SharedMapSystem _mapSystem = default!; @@ -53,7 +52,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) return; } - if (_map.TryFindGridAt(mapId, position, out var gridUid, out var grid)) + if (_mapSystem.TryFindGridAt(mapId, position, out var gridUid, out var grid)) { var gridPos = Vector2.Transform(position, _transform.GetInvWorldMatrix(gridUid)); diff --git a/Robust.Shared/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index 2df50e9dbf9..dec2756581a 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -37,7 +37,6 @@ public abstract partial class EntityManager : IEntityManager [IoC.Dependency] protected IPrototypeManager PrototypeManager = default!; [IoC.Dependency] protected ILogManager LogManager = default!; [IoC.Dependency] private IEntitySystemManager _entitySystemManager = default!; - [IoC.Dependency] private IMapManager _mapManager = default!; [IoC.Dependency] private IGameTiming _gameTiming = default!; [IoC.Dependency] private ISerializationManager _serManager = default!; [IoC.Dependency] private ProfManager _prof = default!; @@ -360,7 +359,7 @@ public virtual EntityUid CreateEntityUninitialized(string? prototypeName, MapCoo throw new ArgumentException($"Attempted to spawn entity on an invalid map. Coordinates: {coordinates}"); EntityCoordinates coords; - if (_mapManager.TryFindGridAt(coordinates, out var gridUid, out var grid) + if (_mapSystem.TryFindGridAt(coordinates, out var gridUid, out var grid) && MetaQuery.TryGetComponentInternal(gridUid, out var meta) && meta.EntityLifeStage < EntityLifeStage.Terminating) { diff --git a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs index 7d7d2ead228..dde211ed9b5 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs @@ -93,7 +93,7 @@ private void AddEntitiesIntersecting(MapId mapId, flags); // Need to include maps - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid uid, MapGridComponent _, ref EntityQueryState state) => { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); @@ -244,7 +244,7 @@ private bool AnyEntitiesIntersecting(MapId mapId, flags); // Need to include maps - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid uid, MapGridComponent _, ref AnyEntityQueryState state) => { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); @@ -556,7 +556,7 @@ public void GetEntitiesIntersecting(EntityUid uid, HashSet intersecti var state = (uid, transform, intersecting, _fixturesQuery, this, _physics, flags); // Unfortuantely I can't think of a way to de-dupe this with the other ones as it's slightly different. - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid gridUid, MapGridComponent grid, ref (EntityUid entity, Transform transform, HashSet intersecting, EntityQuery fixturesQuery, EntityLookupSystem lookup, SharedPhysicsSystem physics, LookupFlags flags) state) => @@ -786,7 +786,7 @@ public void FindLookupsIntersecting(MapId mapId, Box2Rotated worldBounds, Compon var state = (callback, _broadQuery); - _mapManager.FindGridsIntersecting(mapId, worldBounds, ref state, + _map.FindGridsIntersecting(mapId, worldBounds, ref state, static (EntityUid uid, MapGridComponent grid, ref (ComponentQueryCallback callback, EntityQuery _broadQuery) tuple) => diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index 16d33310d35..f579ecc7bc6 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -458,7 +458,7 @@ public bool AnyComponentsIntersecting(Type type, MapId mapId, T shape, Transf // Get grid entities var state = (this, worldAABB, flags, query, ignored, found: false); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid uid, MapGridComponent grid, ref (EntityLookupSystem system, Box2 worldAABB, @@ -550,7 +550,7 @@ public void GetEntitiesIntersecting(Type type, MapId mapId, T shape, Transfor // Get grid entities var state = new GridQueryState(intersecting, shape, shapeTransform, this, _physics, flags, query); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid uid, MapGridComponent grid, ref GridQueryState state) => { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); @@ -596,7 +596,7 @@ public void GetEntitiesIntersecting(MapId mapId, TShape shape, Transf // Get grid entities var state = new GridQueryState(entities, shape, shapeTransform, this, _physics, flags, query); - _mapManager.FindGridsIntersecting(mapId, worldAABB, ref state, + _map.FindGridsIntersecting(mapId, worldAABB, ref state, static (EntityUid uid, MapGridComponent grid, ref GridQueryState state) => { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.cs index 1d1e90c671d..25e124922f9 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.cs @@ -73,7 +73,6 @@ public record struct WorldAABBEvent public sealed partial class EntityLookupSystem : EntitySystem { [Dependency] private IManifoldManager _manifoldManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IGameTiming _timing = default!; [Dependency] private INetManager _netMan = default!; [Dependency] private SharedContainerSystem _container = default!; diff --git a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs index 2fa10c984a6..6f90d0fa3f1 100644 --- a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs +++ b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs @@ -283,7 +283,7 @@ private void OnCompInit(EntityUid uid, TransformComponent component, ComponentIn // Entity may not be directly parented to the grid (e.g., spawned using some relative entity coordinates) // in that case, we attempt to attach to a grid. var pos = new MapCoordinates(GetWorldPosition(component), component.MapID); - if (_mapManager.TryFindGridAt(pos, out var gridUid, out gridComp)) + if (_map.TryFindGridAt(pos, out var gridUid, out gridComp)) grid = (gridUid, gridComp); } @@ -990,7 +990,7 @@ public void SetMapCoordinates(Entity entity, MapCoordinates { var mapUid = _map.GetMap(coordinates.MapId); if (!_gridQuery.HasComponent(entity) && - _mapManager.TryFindGridAt(mapUid, coordinates.Position, out var targetGrid, out _)) + _map.TryFindGridAt(mapUid, coordinates.Position, out var targetGrid, out _)) { var invWorldMatrix = GetInvWorldMatrix(targetGrid); SetCoordinates((entity.Owner, entity.Comp, MetaData(entity.Owner)), new EntityCoordinates(targetGrid, Vector2.Transform(coordinates.Position, invWorldMatrix))); @@ -1233,7 +1233,7 @@ private void SetWorldPositionRotationInternal(EntityUid uid, Vector2 worldPos, A return; } - if (component.GridUid != uid && _mapManager.TryFindGridAt(component.MapUid.Value, worldPos, out var targetGrid, out _)) + if (component.GridUid != uid && _map.TryFindGridAt(component.MapUid.Value, worldPos, out var targetGrid, out _)) { var targetGridXform = XformQuery.GetComponent(targetGrid); var invLocalMatrix = targetGridXform.InvLocalMatrix; @@ -1487,7 +1487,7 @@ public bool TryGetMapOrGridCoordinates( return false; var oldPos = GetWorldPosition(xform); - if (_mapManager.TryFindGridAt(map, oldPos, out var gridUid, out _) && !TerminatingOrDeleted(gridUid)) + if (_map.TryFindGridAt(map, oldPos, out var gridUid, out _) && !TerminatingOrDeleted(gridUid)) { coordinates = gridUid == xform.ParentUid ? new EntityCoordinates(gridUid, xform.LocalPosition) @@ -1747,7 +1747,7 @@ public bool SwapPositions(Entity entity1, Entity entity1, Entity>(); - mapManager.FindGridsIntersecting(mapCoords.MapId, gridSearchBox, ref gridsInArea); + mapSystem.FindGridsIntersecting(mapCoords.MapId, gridSearchBox, ref gridsInArea); // find closest grid intersecting our search box. gridUid = EntityUid.Invalid; From 13723b8573fce76dcd18954a0194d6f96a33f5cb Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 04:35:12 -0700 Subject: [PATCH 16/21] The rest --- .../Components/TransformComponentTests.cs | 9 ++++--- Robust.Client/Debugging/DebugPhysicsSystem.cs | 20 +++++++++----- .../EntitySystems/DebugLightTreeSystem.cs | 4 +-- .../GridChunkBoundsDebugSystem.cs | 7 +---- Robust.Client/Physics/GridFixtureSystem.cs | 5 ++-- Robust.Client/Placement/IPlacementManager.cs | 1 + Robust.Client/Placement/Modes/AlignTileAny.cs | 2 +- Robust.Client/Placement/PlacementManager.cs | 1 + Robust.Client/Placement/PlacementMode.cs | 5 ++-- .../DebugMonitorControls/DebugCoordsPanel.cs | 5 ++-- .../Editors/VVPropEditorEntityCoordinates.cs | 1 - .../GameObjects/Components/Container_Test.cs | 6 +++-- Robust.Server/Placement/PlacementManager.cs | 13 +++++----- .../EntityLookup_Test.cs | 26 +++++++------------ .../Systems/AnchoredSystemTests.cs | 6 ++--- .../Map/EntityCoordinates_Tests.cs | 24 ++++++++--------- .../Map/MapPauseTests.cs | 7 +++-- .../Physics/GridDeletion_Test.cs | 8 +++--- .../Physics/MapVelocity_Test.cs | 10 +++---- .../Spawning/EntitySpawnHelpersTest.cs | 1 + .../ScriptGlobalsShared.cs | 1 + .../EntitySerialization/MapChunkSerializer.cs | 13 +++++----- .../Transform/TransformComponent.cs | 4 +-- Robust.Shared/Map/CoordinatesExtensions.cs | 2 +- Robust.Shared/Map/EntityCoordinates.cs | 10 ++++++- Robust.UnitTesting/IIntegrationInstance.cs | 1 + Robust.UnitTesting/Pool/TestPair.Helpers.cs | 2 +- Robust.UnitTesting/RobustIntegrationTest.cs | 1 + 28 files changed, 100 insertions(+), 95 deletions(-) diff --git a/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs b/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs index 0f5a3e3c289..1b774095a6f 100644 --- a/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs +++ b/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs @@ -19,12 +19,13 @@ private static (ISimulation, EntityUid gridA, EntityUid gridB) SimulationFactor .NewSimulation() .InitializeInstance(); - var mapId = sim.Resolve().System().CreateMap(); - var mapManager = sim.Resolve(); + var entMan = sim.Resolve(); + var mapSys = entMan.System(); + var mapId = mapSys.CreateMap(); // Adds two grids to use in tests. - var gridA = mapManager.CreateGridEntity(mapId); - var gridB = mapManager.CreateGridEntity(mapId); + var gridA = mapSys.CreateGridEntity(mapId); + var gridB = mapSys.CreateGridEntity(mapId); return (sim, gridA, gridB); } diff --git a/Robust.Client/Debugging/DebugPhysicsSystem.cs b/Robust.Client/Debugging/DebugPhysicsSystem.cs index d34944a415d..972ab0ad979 100644 --- a/Robust.Client/Debugging/DebugPhysicsSystem.cs +++ b/Robust.Client/Debugging/DebugPhysicsSystem.cs @@ -84,7 +84,7 @@ public sealed partial class DebugPhysicsSystem : SharedDebugPhysicsSystem [Dependency] private IOverlayManager _overlay = default!; [Dependency] private IEyeManager _eye = default!; [Dependency] private IInputManager _input = default!; - [Dependency] private IMapManager _map = default!; + [Dependency] private SharedMapSystem _map = default!; [Dependency] private IPlayerManager _player = default!; [Dependency] private IResourceCache _resourceCache = default!; @@ -103,13 +103,13 @@ public PhysicsDebugFlags Flags EntityManager, _eye, _input, - _map, _player, _resourceCache, this, _entityLookup, _physics, - _transform)); + _transform, + _map)); if (value == PhysicsDebugFlags.None) _overlay.RemoveOverlay(typeof(PhysicsDebugOverlay)); @@ -203,12 +203,12 @@ internal sealed class PhysicsDebugOverlay : Overlay private readonly IEntityManager _entityManager; private readonly IEyeManager _eyeManager; private readonly IInputManager _inputManager; - private readonly IMapManager _mapManager; private readonly IPlayerManager _playerManager; private readonly DebugPhysicsSystem _debugPhysicsSystem; private readonly EntityLookupSystem _lookup; private readonly SharedPhysicsSystem _physicsSystem; private readonly SharedTransformSystem _transformSystem; + private readonly SharedMapSystem _mapSystem; public override OverlaySpace Space => OverlaySpace.WorldSpace | OverlaySpace.ScreenSpace; @@ -219,20 +219,26 @@ internal sealed class PhysicsDebugOverlay : Overlay private HashSet _drawnJoints = new(); private List> _grids = new(); - public PhysicsDebugOverlay(IEntityManager entityManager, IEyeManager eyeManager, IInputManager inputManager, IMapManager mapManager, IPlayerManager playerManager, IResourceCache cache, DebugPhysicsSystem system, EntityLookupSystem lookup, SharedPhysicsSystem physicsSystem, SharedTransformSystem transformSystem) + public PhysicsDebugOverlay(IEntityManager entityManager, IEyeManager eyeManager, IInputManager inputManager, IPlayerManager playerManager, IResourceCache cache, DebugPhysicsSystem system, EntityLookupSystem lookup, SharedPhysicsSystem physicsSystem, SharedTransformSystem transformSystem, SharedMapSystem mapSystem) { _entityManager = entityManager; _eyeManager = eyeManager; _inputManager = inputManager; - _mapManager = mapManager; _playerManager = playerManager; _debugPhysicsSystem = system; _lookup = lookup; _physicsSystem = physicsSystem; _transformSystem = transformSystem; + _mapSystem = mapSystem; _font = new VectorFont(cache.GetResource("/EngineFonts/NotoSans/NotoSans-Regular.ttf"), 10); } + [Obsolete("use the constructor that does not take IMapManager")] + public PhysicsDebugOverlay(IEntityManager entityManager, IEyeManager eyeManager, IInputManager inputManager, IMapManager mapManager, IPlayerManager playerManager, IResourceCache cache, DebugPhysicsSystem system, EntityLookupSystem lookup, SharedPhysicsSystem physicsSystem, SharedTransformSystem transformSystem, SharedMapSystem? mapSystem = null) + : this(entityManager, eyeManager, inputManager, playerManager, cache, system, lookup, physicsSystem, transformSystem, mapSystem ?? entityManager.System()) + { + } + private void DrawWorld(DrawingHandleWorld worldHandle, OverlayDrawArgs args) { var viewBounds = args.WorldBounds; @@ -293,7 +299,7 @@ private void DrawWorld(DrawingHandleWorld worldHandle, OverlayDrawArgs args) } _grids.Clear(); - _mapManager.FindGridsIntersecting(mapId, viewBounds, ref _grids); + _mapSystem.FindGridsIntersecting(mapId, viewBounds, ref _grids); foreach (var grid in _grids) { diff --git a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs index 4397c4ebeee..c50fa091e60 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs @@ -27,8 +27,6 @@ public bool Enabled { _lightOverlay = new DebugLightOverlay( EntityManager.System(), - IoCManager.Resolve(), - IoCManager.Resolve(), EntityManager.System()); overlayManager.AddOverlay(_lightOverlay); @@ -51,7 +49,7 @@ private sealed class DebugLightOverlay : Overlay public override OverlaySpace Space => OverlaySpace.WorldSpace; - public DebugLightOverlay(EntityLookupSystem lookup, IEyeManager eyeManager, IMapManager mapManager, LightTreeSystem trees) + public DebugLightOverlay(EntityLookupSystem lookup, LightTreeSystem trees) { _lookup = lookup; _trees = trees; diff --git a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs index a0fb7a7430a..761244b9b5b 100644 --- a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs @@ -4,7 +4,6 @@ using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.IoC; -using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Maths; using Robust.Shared.Physics; @@ -15,8 +14,6 @@ namespace Robust.Client.GameObjects { public sealed partial class GridChunkBoundsDebugSystem : EntitySystem { - [Dependency] private IEyeManager _eyeManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IOverlayManager _overlayManager = default!; [Dependency] private TransformSystem _transform = default!; [Dependency] private SharedMapSystem _map = default!; @@ -37,8 +34,6 @@ public bool Enabled DebugTools.Assert(_overlay == null); _overlay = new GridChunkBoundsOverlay( EntityManager, - _eyeManager, - _mapManager, _transform, _map); @@ -65,7 +60,7 @@ internal sealed class GridChunkBoundsOverlay : Overlay private List> _grids = new(); - public GridChunkBoundsOverlay(IEntityManager entManager, IEyeManager eyeManager, IMapManager mapManager, SharedTransformSystem transformSystem, SharedMapSystem mapSystem) + public GridChunkBoundsOverlay(IEntityManager entManager, SharedTransformSystem transformSystem, SharedMapSystem mapSystem) { _entityManager = entManager; _transformSystem = transformSystem; diff --git a/Robust.Client/Physics/GridFixtureSystem.cs b/Robust.Client/Physics/GridFixtureSystem.cs index 5e995bda220..ac42b077369 100644 --- a/Robust.Client/Physics/GridFixtureSystem.cs +++ b/Robust.Client/Physics/GridFixtureSystem.cs @@ -13,7 +13,6 @@ namespace Robust.Client.Physics internal sealed partial class GridFixtureSystem : SharedGridFixtureSystem { [Dependency] private IOverlayManager _overlay = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private SharedTransformSystem _transform = default!; [Dependency] private SharedMapSystem _map = default!; @@ -29,7 +28,7 @@ public bool EnableDebug if (_enableDebug) { - var overlay = new GridSplitNodeOverlay(_mapManager, this, _transform, _map); + var overlay = new GridSplitNodeOverlay(this, _transform, _map); _overlay.AddOverlay(overlay); RaiseNetworkEvent(new RequestGridNodesMessage()); } @@ -76,7 +75,7 @@ private sealed class GridSplitNodeOverlay : Overlay private readonly SharedTransformSystem _transform; private readonly SharedMapSystem _map; - public GridSplitNodeOverlay(IMapManager mapManager, GridFixtureSystem system, SharedTransformSystem transform, SharedMapSystem map) + public GridSplitNodeOverlay(GridFixtureSystem system, SharedTransformSystem transform, SharedMapSystem map) { _system = system; _transform = transform; diff --git a/Robust.Client/Placement/IPlacementManager.cs b/Robust.Client/Placement/IPlacementManager.cs index 15b8f09167d..e64291e1160 100644 --- a/Robust.Client/Placement/IPlacementManager.cs +++ b/Robust.Client/Placement/IPlacementManager.cs @@ -24,6 +24,7 @@ public interface IPlacementManager IEntityManager EntityManager { get; } IEyeManager EyeManager { get; } + [Obsolete("Use MapSystem")] IMapManager MapManager { get; } /// diff --git a/Robust.Client/Placement/Modes/AlignTileAny.cs b/Robust.Client/Placement/Modes/AlignTileAny.cs index ff51aa89eb0..9523b229514 100644 --- a/Robust.Client/Placement/Modes/AlignTileAny.cs +++ b/Robust.Client/Placement/Modes/AlignTileAny.cs @@ -17,7 +17,7 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) // Go over diagonal size so when placing in a line it doesn't stop snapping. const float searchBoxSize = 2f; // size of search box in meters - MouseCoords = ScreenToCursorGrid(mouseScreen).AlignWithClosestGridTile(searchBoxSize, pManager.EntityManager, pManager.MapManager); + MouseCoords = ScreenToCursorGrid(mouseScreen).AlignWithClosestGridTile(searchBoxSize, pManager.EntityManager); var gridId = pManager.EntityManager.System().GetGrid(MouseCoords); diff --git a/Robust.Client/Placement/PlacementManager.cs b/Robust.Client/Placement/PlacementManager.cs index eda141df12e..843b6f735e2 100644 --- a/Robust.Client/Placement/PlacementManager.cs +++ b/Robust.Client/Placement/PlacementManager.cs @@ -48,6 +48,7 @@ public sealed partial class PlacementManager : IPlacementManager, IDisposable, I public IEntityManager EntityManager => _entityManager; public IEyeManager EyeManager => _eyeManager; + [Obsolete("use SharedMapSystem")] public IMapManager MapManager => _mapManager; private ISawmill _sawmill = default!; diff --git a/Robust.Client/Placement/PlacementMode.cs b/Robust.Client/Placement/PlacementMode.cs index 8ca0de2bd48..810ec1f0220 100644 --- a/Robust.Client/Placement/PlacementMode.cs +++ b/Robust.Client/Placement/PlacementMode.cs @@ -201,7 +201,7 @@ public TileRef GetTileRef(EntityCoordinates coordinates) return gridUidOpt is { } gridUid && gridUid.IsValid() ? pManager.EntityManager.System().GetTileRef(gridUid, pManager.EntityManager.GetComponent(gridUid), MouseCoords) : new TileRef(gridUidOpt ?? EntityUid.Invalid, - MouseCoords.ToVector2i(pManager.EntityManager, pManager.MapManager, pManager.EntityManager.System()), Tile.Empty); + MouseCoords.ToVector2i(pManager.EntityManager, pManager.EntityManager.System()), Tile.Empty); } public TextureResource GetSprite(string key) @@ -267,7 +267,8 @@ protected EntityCoordinates ScreenToCursorGrid(ScreenCoordinates coords) { var mapCoords = pManager.EyeManager.PixelToMap(coords.Position); var transformSys = pManager.EntityManager.System(); - if (!pManager.MapManager.TryFindGridAt(mapCoords, out var gridUid, out _)) + var mapSys = pManager.EntityManager.System(); + if (!mapSys.TryFindGridAt(mapCoords, out var gridUid, out _)) { return transformSys.ToCoordinates(mapCoords); } diff --git a/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs b/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs index 86ff546fb2f..f4d643d564d 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs @@ -19,7 +19,6 @@ internal sealed partial class DebugCoordsPanel : PanelContainer [Dependency] private IInputManager _inputManager = default!; [Dependency] private IEntityManager _entityManager = default!; [Dependency] private IClyde _displayManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IBaseClient _baseClient = default!; private readonly StringBuilder _textBuilder = new(); @@ -76,7 +75,7 @@ protected override void FrameUpdate(FrameEventArgs args) var mapSystem = _entityManager.System(); var xformSystem = _entityManager.System(); - if (_mapManager.TryFindGridAt(mouseWorldMap, out var mouseGridUid, out var mouseGrid)) + if (mapSystem.TryFindGridAt(mouseWorldMap, out var mouseGridUid, out var mouseGrid)) { mouseGridPos = mapSystem.MapToGrid(mouseGridUid, mouseWorldMap); tile = mapSystem.GetTileRef(mouseGridUid, mouseGrid, mouseGridPos); @@ -86,7 +85,7 @@ protected override void FrameUpdate(FrameEventArgs args) mouseGridPos = new EntityCoordinates(mapSystem.GetMapOrInvalid(mouseWorldMap.MapId), mouseWorldMap.Position); tile = new TileRef(EntityUid.Invalid, - mouseGridPos.ToVector2i(_entityManager, _mapManager, xformSystem), Tile.Empty); + mouseGridPos.ToVector2i(_entityManager, xformSystem), Tile.Empty); } } } diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs index 91620f5b544..840cd81de8a 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs @@ -63,7 +63,6 @@ protected override Control MakeUI(object? value) void OnEntered(LineEdit.LineEditEventArgs e) { var gridVal = EntityUid.Parse(gridId.Text); - var mapManager = IoCManager.Resolve(); var xVal = float.Parse(x.Text, CultureInfo.InvariantCulture); var yVal = float.Parse(y.Text, CultureInfo.InvariantCulture); diff --git a/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs b/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs index 87f39f7a05c..175551d45d5 100644 --- a/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs +++ b/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs @@ -182,9 +182,11 @@ public void BaseContainer_InsertMap_False() public void BaseContainer_InsertGrid_False() { var sim = SimulationFactory(); - var containerSys = sim.Resolve().GetEntitySystem(); + var entMan = sim.Resolve(); + var mapSys = entMan.System(); + var containerSys = entMan.System(); - var grid = sim.Resolve().CreateGridEntity(new MapId(1)).Owner; + var grid = mapSys.CreateGridEntity(new MapId(1)).Owner; var entity = sim.SpawnEntity(null,_coords); var container = containerSys.MakeContainer(entity, "dummy"); diff --git a/Robust.Server/Placement/PlacementManager.cs b/Robust.Server/Placement/PlacementManager.cs index a7868c8730a..f4d426f669b 100644 --- a/Robust.Server/Placement/PlacementManager.cs +++ b/Robust.Server/Placement/PlacementManager.cs @@ -28,7 +28,6 @@ public sealed partial class PlacementManager : IPlacementManager [Dependency] private IPlayerManager _playerManager = default!; [Dependency] private IPrototypeManager _prototype = default!; [Dependency] private IServerEntityManager _entityManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private ILogManager _logManager = default!; private EntityLookupSystem _lookup => _entityManager.System(); @@ -190,27 +189,29 @@ private void PlaceNewTile(int tileType, EntityCoordinates coordinates, NetUserId { if (!coordinates.IsValid(_entityManager)) return; + var mapSystem = _maps; + MapGridComponent? grid; EntityUid gridId = coordinates.EntityId; if (_entityManager.TryGetComponent(coordinates.EntityId, out grid) - || _mapManager.TryFindGridAt(_xformSystem.ToMapCoordinates(coordinates), out gridId, out grid)) + || mapSystem.TryFindGridAt(_xformSystem.ToMapCoordinates(coordinates), out gridId, out grid)) { - _maps.SetTile(gridId, grid, coordinates, new Tile(tileType, rotationMirroring: (byte)(direction + (mirrored ? 4 : 0)))); + mapSystem.SetTile(gridId, grid, coordinates, new Tile(tileType, rotationMirroring: (byte)(direction + (mirrored ? 4 : 0)))); var placementEraseEvent = new PlacementTileEvent(tileType, coordinates, placingUserId); _entityManager.EventBus.RaiseEvent(EventSource.Local, placementEraseEvent); } else if (tileType != 0) // create a new grid { - var newGrid = _mapManager.CreateGridEntity(_xformSystem.GetMapId(coordinates)); + var newGrid = mapSystem.CreateGridEntity(_xformSystem.GetMapId(coordinates)); var newGridXform = new Entity( newGrid.Owner, _entityManager.GetComponent(newGrid)); _xformSystem.SetWorldPosition(newGridXform, coordinates.Position - newGrid.Comp.TileSizeHalfVector); // assume bottom left tile origin - var tilePos = _maps.WorldToTile(newGrid.Owner, newGrid.Comp, coordinates.Position); - _maps.SetTile(newGrid.Owner, newGrid.Comp, tilePos, new Tile(tileType, rotationMirroring: (byte)(direction + (mirrored ? 4 : 0)))); + var tilePos = mapSystem.WorldToTile(newGrid.Owner, newGrid.Comp, coordinates.Position); + mapSystem.SetTile(newGrid.Owner, newGrid.Comp, tilePos, new Tile(tileType, rotationMirroring: (byte)(direction + (mirrored ? 4 : 0)))); var placementEraseEvent = new PlacementTileEvent(tileType, coordinates, placingUserId); _entityManager.EventBus.RaiseEvent(EventSource.Local, placementEraseEvent); diff --git a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs index d29062a714c..a6e4b60aa33 100644 --- a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs +++ b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs @@ -65,7 +65,7 @@ private EntityUid GetPhysicsEntity(IEntityManager entManager, MapCoordinates spa return ent; } - private Entity SetupGrid(MapId mapId, SharedMapSystem mapSystem, IEntityManager entManager, IMapManager mapManager) + private Entity SetupGrid(MapId mapId, SharedMapSystem mapSystem, IEntityManager entManager) { var grid = mapSystem.CreateGridEntity(mapId); entManager.System().SetLocalPosition(grid.Owner, new Vector2(10f, 10f)); @@ -88,11 +88,10 @@ public void TestEntityAnyIntersecting(bool physics, MapCoordinates spawnPos, Box var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -113,11 +112,10 @@ public void TestEntityAnyLocalIntersecting(bool physics, MapCoordinates spawnPos var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -141,11 +139,10 @@ public void TestEntityGridLocalIntersecting(bool physics, MapCoordinates spawnPo var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -170,11 +167,10 @@ public void TestEntityGridTileIntersecting(bool physics, MapCoordinates spawnPos var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -221,11 +217,10 @@ public void TestGridIntersecting(bool physics, MapCoordinates spawnPos, MapCoord var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -247,11 +242,10 @@ public void TestGridInRange(bool physics, MapCoordinates spawnPos, MapCoordinate var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -295,11 +289,10 @@ public void TestGridAnyIntersecting(bool physics, MapCoordinates spawnPos, Box2 var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); @@ -323,11 +316,10 @@ public void TestGridLocalIntersecting(bool physics, MapCoordinates spawnPos, Box var lookup = server.Resolve().GetEntitySystem(); var entManager = server.Resolve(); - var mapManager = server.Resolve(); var mapSystem = entManager.System(); mapSystem.CreateMap(spawnPos.MapId); - var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager, mapManager); + var grid = SetupGrid(spawnPos.MapId, mapSystem, entManager); if (physics) GetPhysicsEntity(entManager, spawnPos); diff --git a/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs b/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs index 0f6ab766eb1..d3abfc2e0e1 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs @@ -38,14 +38,14 @@ private static (ISimulation, Entity grid, MapCoordinates, Shar }) .InitializeInstance(); - var mapManager = sim.Resolve(); + var mapSystem = sim.System(); var testMapId = sim.CreateMap().MapId; var coords = new MapCoordinates(new Vector2(7, 7), testMapId); // Add grid 1, as the default grid to anchor things to. - var grid = mapManager.CreateGridEntity(testMapId); + var grid = mapSystem.CreateGridEntity(testMapId); - return (sim, grid, coords, sim.System(), sim.System()); + return (sim, grid, coords, sim.System(), mapSystem); } // An entity is anchored to the tile it is over on the target grid. diff --git a/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs b/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs index 4858f405e33..c2c3035dab4 100644 --- a/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs @@ -121,11 +121,11 @@ public void GetGridId_Map() public void GetGridId_Grid() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(gridEnt, Vector2.Zero)); @@ -151,11 +151,11 @@ public void GetMapId_Map() public void GetMapId_Grid() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(gridEnt, Vector2.Zero)); @@ -167,11 +167,11 @@ public void GetMapId_Grid() public void GetParent() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); var mapEnt = entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(grid, Vector2.Zero)); @@ -189,11 +189,11 @@ public void GetParent() public void TryGetParent() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); var mapEnt = entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(grid, Vector2.Zero)); @@ -240,11 +240,11 @@ public void ToMap_MoveGrid(float x1, float y1, float x2, float y2) var entPos = new Vector2(x2, y2); var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(grid, entPos)); var newXform = entityManager.GetComponent(newEnt); @@ -262,11 +262,11 @@ public void ToMap_MoveGrid(float x1, float y1, float x2, float y2) public void WithEntityId() { var entityManager = IoCManager.Resolve(); - var mapManager = IoCManager.Resolve(); + var mapSystem = entityManager.System(); var xformSys = entityManager.System(); var mapEnt = entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridEnt = grid.Owner; var newEnt = entityManager.CreateEntityUninitialized(null, new EntityCoordinates(grid, Vector2.Zero)); var newEntXform = entityManager.GetComponent(newEnt); diff --git a/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs index b66f645bff6..55effd21968 100644 --- a/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs @@ -122,14 +122,14 @@ public void Paused_AddGrid_GridPaused() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); + var mapSys = entMan.System(); // arrange var mapId = sim.CreateMap().MapId; - entMan.System().SetPaused(mapId, true); + mapSys.SetPaused(mapId, true); // act - var newGrid = mapMan.CreateGridEntity(mapId); + var newGrid = mapSys.CreateGridEntity(mapId); // assert var metaData = entMan.GetComponent(newGrid); @@ -194,7 +194,6 @@ public void Paused_UnpauseMap_UnpausedEntities() { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); var mapId = sim.CreateMap().Uid; entMan.System().SetPaused(mapId, true); diff --git a/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs b/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs index 20b35cdf73c..54214964a33 100644 --- a/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs @@ -27,8 +27,8 @@ public async Task GridDeletionTest() await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); - var physSystem = server.ResolveDependency().GetEntitySystem(); + var mapSystem = entManager.System(); + var physSystem = entManager.System(); PhysicsComponent physics = default!; @@ -38,7 +38,7 @@ public async Task GridDeletionTest() await server.WaitAssertion(() => { entManager.System().CreateMap(out mapId); - grid = mapManager.CreateGridEntity(mapId); + grid = mapSystem.CreateGridEntity(mapId); physics = entManager.GetComponent(grid); physSystem.SetBodyType(grid, BodyType.Dynamic, body: physics); @@ -55,7 +55,7 @@ await server.WaitAssertion(() => List> grids = []; // So if gridtree is fucky then this SHOULD throw. - mapManager.FindGridsIntersecting(mapId, + mapSystem.FindGridsIntersecting(mapId, new Box2(new Vector2(float.MinValue, float.MinValue), new Vector2(float.MaxValue, float.MaxValue)), ref grids); }); diff --git a/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs b/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs index 4067f53d130..23434da3b01 100644 --- a/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs @@ -34,8 +34,8 @@ public async Task TestMapVelocities() await server.WaitIdleAsync(); var entityManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var system = entityManager.EntitySysManager; + var mapSystem = entityManager.System(); var physicsSys = system.GetEntitySystem(); var xformSystem = system.GetEntitySystem(); var traversal = entityManager.System(); @@ -44,8 +44,8 @@ public async Task TestMapVelocities() await server.WaitAssertion(() => { entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); - var grid2 = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); + var grid2 = mapSystem.CreateGridEntity(mapId); var gridUidA = grid.Owner; Assert.That(entityManager.TryGetComponent(gridUidA, out var gridPhysics)); @@ -106,8 +106,8 @@ public async Task TestNestedParentVelocities() await server.WaitIdleAsync(); var entityManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var system = entityManager.EntitySysManager; + var mapSystem = entityManager.System(); var physicsSys = system.GetEntitySystem(); var xformSystem = system.GetEntitySystem(); var traversal = entityManager.System(); @@ -116,7 +116,7 @@ public async Task TestNestedParentVelocities() await server.WaitAssertion(() => { entityManager.System().CreateMap(out var mapId); - var grid = mapManager.CreateGridEntity(mapId); + var grid = mapSystem.CreateGridEntity(mapId); var gridUid = grid.Owner; Assert.That(entityManager.TryGetComponent(gridUid, out var gridPhysics)); diff --git a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs index 3453141b83c..e7b1834b6e4 100644 --- a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs +++ b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs @@ -25,6 +25,7 @@ public abstract partial class EntitySpawnHelpersTest : RobustIntegrationTest protected SharedContainerSystem Container = default!; // Even if unused, content / downstream tests might use this class, so removal would be a breaking change? + [Obsolete("Use MapSystem")] protected IMapManager MapMan = default!; protected EntityUid Map; diff --git a/Robust.Shared.Scripting/ScriptGlobalsShared.cs b/Robust.Shared.Scripting/ScriptGlobalsShared.cs index f384b772c0e..a137062b8df 100644 --- a/Robust.Shared.Scripting/ScriptGlobalsShared.cs +++ b/Robust.Shared.Scripting/ScriptGlobalsShared.cs @@ -34,6 +34,7 @@ public abstract partial class ScriptGlobalsShared : IInvocationContext [Dependency] private IPrototypeManager _prot = null!; public IPrototypeManager prot => _prot; [Dependency] private IMapManager _map = null!; + [Obsolete("use SharedMapSystem instead")] public IMapManager map => _map; [Dependency] private IDependencyCollection _dependencies = null!; public IDependencyCollection dependencies => _dependencies; diff --git a/Robust.Shared/EntitySerialization/MapChunkSerializer.cs b/Robust.Shared/EntitySerialization/MapChunkSerializer.cs index 0b3bb6c1c6a..c5df77dfadb 100644 --- a/Robust.Shared/EntitySerialization/MapChunkSerializer.cs +++ b/Robust.Shared/EntitySerialization/MapChunkSerializer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -41,8 +42,8 @@ public MapChunk Read(ISerializationManager serializationManager, MappingDataNode using var stream = new MemoryStream(tileBytes); using var reader = new BinaryReader(stream); - var mapManager = dependencies.Resolve(); - mapManager.SuppressOnTileChanged = true; + var mapSystem = dependencies.Resolve().System(); + mapSystem.SuppressOnTileChanged = true; ushort size = 16; @@ -112,7 +113,7 @@ public MapChunk Read(ISerializationManager serializationManager, MappingDataNode } chunk.SuppressCollisionRegeneration = false; - mapManager.SuppressOnTileChanged = false; + mapSystem.SuppressOnTileChanged = false; return chunk; } @@ -192,8 +193,8 @@ public MapChunk CreateCopy( SerializationHookContext hookCtx, ISerializationContext? context = null) { - var mapManager = dependencies.Resolve(); - mapManager.SuppressOnTileChanged = true; + var mapSystem = dependencies.Resolve().System(); + mapSystem.SuppressOnTileChanged = true; var chunk = new MapChunk(source.X, source.Y, source.ChunkSize) { SuppressCollisionRegeneration = true @@ -207,7 +208,7 @@ public MapChunk CreateCopy( } } - mapManager.SuppressOnTileChanged = false; + mapSystem.SuppressOnTileChanged = false; chunk.SuppressCollisionRegeneration = false; return chunk; diff --git a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs index f2e132d06cd..ec5ed25c69f 100644 --- a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs +++ b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs @@ -103,8 +103,6 @@ public Matrix3x2 InvLocalMatrix [ViewVariables] internal readonly HashSet _children = new(); - [Dependency] private IMapManager _mapManager = default!; - /// /// Returns the index of the map which this object is on /// @@ -375,7 +373,7 @@ public bool Anchored { _anchored = value; } - else if (value && !_anchored && _mapManager.TryFindGridAt(MapPosition, out _, out var grid)) + else if (value && !_anchored && _entMan.EntitySysManager.GetEntitySystem().TryFindGridAt(MapPosition, out _, out var grid)) { _anchored = _entMan.EntitySysManager.GetEntitySystem().AnchorEntity(Owner, this, grid); } diff --git a/Robust.Shared/Map/CoordinatesExtensions.cs b/Robust.Shared/Map/CoordinatesExtensions.cs index 3ac622baabe..3ebd723101f 100644 --- a/Robust.Shared/Map/CoordinatesExtensions.cs +++ b/Robust.Shared/Map/CoordinatesExtensions.cs @@ -10,7 +10,7 @@ public static class CoordinatesExtensions { public static EntityCoordinates AlignWithClosestGridTile(this EntityCoordinates coords, float searchBoxSize = 1.5f, IEntityManager? entityManager = null, IMapManager? mapManager = null) { - IoCManager.Resolve(ref entityManager, ref mapManager); + IoCManager.Resolve(ref entityManager); var xform = entityManager.System(); var gridId = xform.GetGrid(coords); diff --git a/Robust.Shared/Map/EntityCoordinates.cs b/Robust.Shared/Map/EntityCoordinates.cs index 323fe187cbf..14cf623676e 100644 --- a/Robust.Shared/Map/EntityCoordinates.cs +++ b/Robust.Shared/Map/EntityCoordinates.cs @@ -106,7 +106,6 @@ public static EntityCoordinates FromMap(IMapManager mapManager, MapCoordinates c /// public Vector2i ToVector2i( IEntityManager entityManager, - IMapManager mapManager, SharedTransformSystem transformSystem) { if(!IsValid(entityManager)) @@ -125,6 +124,15 @@ public Vector2i ToVector2i( return new Vector2i((int)MathF.Floor(vec.X), (int)MathF.Floor(vec.Y)); } + [Obsolete("use the version without IMapManager")] + public Vector2i ToVector2i( + IEntityManager entityManager, + IMapManager mapManager, + SharedTransformSystem transformSystem) + { + return ToVector2i(entityManager, transformSystem); + } + /// /// Returns an new set of EntityCoordinates with the same /// but on a different position. diff --git a/Robust.UnitTesting/IIntegrationInstance.cs b/Robust.UnitTesting/IIntegrationInstance.cs index f7c00c1f5c2..63a07de61ce 100644 --- a/Robust.UnitTesting/IIntegrationInstance.cs +++ b/Robust.UnitTesting/IIntegrationInstance.cs @@ -31,6 +31,7 @@ public interface IIntegrationInstance : IDisposable IConfigurationManager CfgMan { get; } ISharedPlayerManager PlayerMan { get; } INetManager NetMan { get; } + [Obsolete("use SharedMapSystem")] IMapManager MapMan { get; } IGameTiming Timing { get; } ISawmill Log { get; } diff --git a/Robust.UnitTesting/Pool/TestPair.Helpers.cs b/Robust.UnitTesting/Pool/TestPair.Helpers.cs index 624b7241e35..f40c39f0a59 100644 --- a/Robust.UnitTesting/Pool/TestPair.Helpers.cs +++ b/Robust.UnitTesting/Pool/TestPair.Helpers.cs @@ -281,7 +281,7 @@ public async Task CreateTestMap(bool initialized, ushort tileTypeId await Server.WaitPost(() => { TestMap.MapUid = sys.CreateMap(out TestMap.MapId, runMapInit: initialized); - TestMap.Grid = Server.MapMan.CreateGridEntity(TestMap.MapId); + TestMap.Grid = sys.CreateGridEntity(TestMap.MapId); TestMap.GridCoords = new EntityCoordinates(TestMap.Grid, 0, 0); TestMap.MapCoords = new MapCoordinates(0, 0, TestMap.MapId); sys.SetTile(TestMap.Grid.Owner, TestMap.Grid.Comp, TestMap.GridCoords, new Tile(tileTypeId)); diff --git a/Robust.UnitTesting/RobustIntegrationTest.cs b/Robust.UnitTesting/RobustIntegrationTest.cs index 48be5149599..9dac3b619f9 100644 --- a/Robust.UnitTesting/RobustIntegrationTest.cs +++ b/Robust.UnitTesting/RobustIntegrationTest.cs @@ -323,6 +323,7 @@ public abstract class IntegrationInstance : IIntegrationInstance public ISharedPlayerManager PlayerMan { get; private set; } = default!; public INetManager NetMan { get; private set; } = default!; public IGameTiming Timing { get; private set; } = default!; + [Obsolete("use SharedMapSystem")] public IMapManager MapMan { get; private set; } = default!; public IConsoleHost ConsoleHost { get; private set; } = default!; public ISawmill Log { get; private set; } = default!; From f6ecc86b4e9dac717956d9fafcc038ce631d635a Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 04:40:42 -0700 Subject: [PATCH 17/21] Purge IMapManager --- Robust.Client/BaseClient.cs | 3 - Robust.Client/ClientIoC.cs | 3 - Robust.Client/Debugging/DebugPhysicsSystem.cs | 6 - .../Debugging/Overlays/TileDebugOverlay.cs | 2 - .../GameController/GameController.cs | 2 - Robust.Client/Placement/IPlacementManager.cs | 2 - Robust.Client/Placement/PlacementManager.cs | 3 - .../RobustServerSimulation.cs | 7 - Robust.Server/BaseServer.cs | 3 - Robust.Server/ServerIoC.cs | 3 - .../Map/MapManager_Tests.cs | 83 ------ .../Spawning/EntitySpawnHelpersTest.cs | 5 - .../ScriptGlobalsShared.cs | 3 - Robust.Shared/Map/CoordinatesExtensions.cs | 2 +- Robust.Shared/Map/EntityCoordinates.cs | 15 - Robust.Shared/Map/IMapManager.cs | 259 ------------------ Robust.Shared/Map/IMapManagerInternal.cs | 20 -- Robust.Shared/Map/MapId.cs | 1 - .../Map/MapManager.GridCollection.cs | 100 ------- Robust.Shared/Map/MapManager.MapCollection.cs | 85 ------ Robust.Shared/Map/MapManager.Pause.cs | 40 --- Robust.Shared/Map/MapManager.Queries.cs | 195 ------------- Robust.Shared/Map/MapManager.cs | 61 ----- Robust.Shared/Map/NetworkedMapManager.cs | 21 -- Robust.UnitTesting/IIntegrationInstance.cs | 2 - Robust.UnitTesting/RobustIntegrationTest.cs | 3 - Robust.UnitTesting/RobustUnitTest.cs | 3 - 27 files changed, 1 insertion(+), 931 deletions(-) delete mode 100644 Robust.Shared.IntegrationTests/Map/MapManager_Tests.cs delete mode 100644 Robust.Shared/Map/IMapManager.cs delete mode 100644 Robust.Shared/Map/IMapManagerInternal.cs delete mode 100644 Robust.Shared/Map/MapManager.GridCollection.cs delete mode 100644 Robust.Shared/Map/MapManager.MapCollection.cs delete mode 100644 Robust.Shared/Map/MapManager.Pause.cs delete mode 100644 Robust.Shared/Map/MapManager.Queries.cs delete mode 100644 Robust.Shared/Map/MapManager.cs delete mode 100644 Robust.Shared/Map/NetworkedMapManager.cs diff --git a/Robust.Client/BaseClient.cs b/Robust.Client/BaseClient.cs index 428ab9859ce..4c8dbf89e2e 100644 --- a/Robust.Client/BaseClient.cs +++ b/Robust.Client/BaseClient.cs @@ -26,7 +26,6 @@ public sealed partial class BaseClient : IBaseClient, IPostInjectInit [Dependency] private IPlayerManager _playMan = default!; [Dependency] private IClientNetConfigurationManager _configManager = default!; [Dependency] private IClientEntityManager _entityManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IDiscordRichPresence _discord = default!; [Dependency] private IGameTiming _timing = default!; [Dependency] private IClientGameStateManager _gameStates = default!; @@ -247,7 +246,6 @@ private void OnNetDisconnect(object? sender, NetDisconnectedArgs args) private void GameStartedSetup() { _entityManager.Startup(); - _mapManager.Startup(); _timing.ResetSimTime(_timeBase); _timing.Paused = false; @@ -259,7 +257,6 @@ private void GameStoppedReset() _gameStates.Reset(); _playMan.Shutdown(); _entityManager.Shutdown(); - _mapManager.Shutdown(); _discord.ClearPresence(); Reset(); } diff --git a/Robust.Client/ClientIoC.cs b/Robust.Client/ClientIoC.cs index 3df84845048..7a2ca8e14fe 100644 --- a/Robust.Client/ClientIoC.cs +++ b/Robust.Client/ClientIoC.cs @@ -66,9 +66,6 @@ public static void RegisterIoC(GameController.DisplayMode mode, IDependencyColle deps.Register(); deps.Register(); deps.Register(); - deps.Register(); - deps.Register(); - deps.Register(); deps.Register(); deps.Register(); deps.Register(); diff --git a/Robust.Client/Debugging/DebugPhysicsSystem.cs b/Robust.Client/Debugging/DebugPhysicsSystem.cs index 972ab0ad979..df1e357be7c 100644 --- a/Robust.Client/Debugging/DebugPhysicsSystem.cs +++ b/Robust.Client/Debugging/DebugPhysicsSystem.cs @@ -233,12 +233,6 @@ public PhysicsDebugOverlay(IEntityManager entityManager, IEyeManager eyeManager, _font = new VectorFont(cache.GetResource("/EngineFonts/NotoSans/NotoSans-Regular.ttf"), 10); } - [Obsolete("use the constructor that does not take IMapManager")] - public PhysicsDebugOverlay(IEntityManager entityManager, IEyeManager eyeManager, IInputManager inputManager, IMapManager mapManager, IPlayerManager playerManager, IResourceCache cache, DebugPhysicsSystem system, EntityLookupSystem lookup, SharedPhysicsSystem physicsSystem, SharedTransformSystem transformSystem, SharedMapSystem? mapSystem = null) - : this(entityManager, eyeManager, inputManager, playerManager, cache, system, lookup, physicsSystem, transformSystem, mapSystem ?? entityManager.System()) - { - } - private void DrawWorld(DrawingHandleWorld worldHandle, OverlayDrawArgs args) { var viewBounds = args.WorldBounds; diff --git a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs index b157af2654e..d3f1df1639c 100644 --- a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs +++ b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs @@ -25,8 +25,6 @@ public abstract partial class TileDebugOverlay : Overlay, IPostInjectInit { [Dependency] protected IEntityManager Entity = default!; [Dependency] protected IEyeManager Eye = default!; - [Obsolete("use SharedMapSystem")] - [Dependency] protected IMapManager MapMan = default!; [Dependency] protected IInputManager Input = default!; [Dependency] protected IUserInterfaceManager Ui = default!; [Dependency] protected IResourceCache Cache = default!; diff --git a/Robust.Client/GameController/GameController.cs b/Robust.Client/GameController/GameController.cs index 1071ea0df48..51189bbeb9a 100644 --- a/Robust.Client/GameController/GameController.cs +++ b/Robust.Client/GameController/GameController.cs @@ -61,7 +61,6 @@ internal sealed partial class GameController : IGameControllerInternal [Dependency] private IXamlHotReloadManager _xamlHotReloadManager = default!; [Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IClientNetManager _networkManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IStateManager _stateManager = default!; [Dependency] private IUserInterfaceManagerInternal _userInterfaceManager = default!; [Dependency] private IBaseClient _client = default!; @@ -236,7 +235,6 @@ internal bool StartupContinue(DisplayMode displayMode) _loadscr.LoadingStep(_userInterfaceManager.Initialize, "UI init"); _loadscr.LoadingStep(_eyeManager.Initialize, _eyeManager); _loadscr.LoadingStep(_entityManager.Initialize, _entityManager); - _loadscr.LoadingStep(_mapManager.Initialize, _mapManager); _loadscr.LoadingStep(_gameStateManager.Initialize, _gameStateManager); _loadscr.LoadingStep(_placementManager.Initialize, _placementManager); _loadscr.LoadingStep(_viewVariablesManager.Initialize, _viewVariablesManager); diff --git a/Robust.Client/Placement/IPlacementManager.cs b/Robust.Client/Placement/IPlacementManager.cs index e64291e1160..756521b2e1c 100644 --- a/Robust.Client/Placement/IPlacementManager.cs +++ b/Robust.Client/Placement/IPlacementManager.cs @@ -24,8 +24,6 @@ public interface IPlacementManager IEntityManager EntityManager { get; } IEyeManager EyeManager { get; } - [Obsolete("Use MapSystem")] - IMapManager MapManager { get; } /// /// The direction to spawn the entity in (presently exposed for EntitySpawnWindow UI) diff --git a/Robust.Client/Placement/PlacementManager.cs b/Robust.Client/Placement/PlacementManager.cs index 843b6f735e2..26d928fa51b 100644 --- a/Robust.Client/Placement/PlacementManager.cs +++ b/Robust.Client/Placement/PlacementManager.cs @@ -33,7 +33,6 @@ public sealed partial class PlacementManager : IPlacementManager, IDisposable, I [Dependency] internal IPlayerManager PlayerManager = default!; [Dependency] internal IResourceCache ResourceCache = default!; [Dependency] private IReflectionManager _reflectionManager = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private IGameTiming _time = default!; [Dependency] private IEyeManager _eyeManager = default!; [Dependency] internal IInputManager InputManager = default!; @@ -48,8 +47,6 @@ public sealed partial class PlacementManager : IPlacementManager, IDisposable, I public IEntityManager EntityManager => _entityManager; public IEyeManager EyeManager => _eyeManager; - [Obsolete("use SharedMapSystem")] - public IMapManager MapManager => _mapManager; private ISawmill _sawmill = default!; diff --git a/Robust.Server.Testing/RobustServerSimulation.cs b/Robust.Server.Testing/RobustServerSimulation.cs index 66eb92d861d..5b6591eabd4 100644 --- a/Robust.Server.Testing/RobustServerSimulation.cs +++ b/Robust.Server.Testing/RobustServerSimulation.cs @@ -248,9 +248,6 @@ public ISimulation InitializeInstance() container.Register(); container.Register(); container.Register(); - container.Register(); - container.Register(); - container.Register(); container.Register(); container.Register(); container.Register(); @@ -341,11 +338,7 @@ public ISimulation InitializeInstance() _systemDelegate?.Invoke(entitySystemMan); - var mapManager = container.Resolve(); - mapManager.Initialize(); - entityMan.Startup(); - mapManager.Startup(); container.Resolve().Initialize(true); container.Resolve().Initialize(); diff --git a/Robust.Server/BaseServer.cs b/Robust.Server/BaseServer.cs index 7275de37265..65c1d2b221e 100644 --- a/Robust.Server/BaseServer.cs +++ b/Robust.Server/BaseServer.cs @@ -80,7 +80,6 @@ internal sealed partial class BaseServer : IBaseServerInternal, IPostInjectInit [Dependency] private IRobustSerializer _serializer = default!; [Dependency] private IGameTiming _time = default!; [Dependency] private IResourceManagerInternal _resources = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private ITimerManager _timerManager = default!; [Dependency] private IServerGameStateManager _stateManager = default!; [Dependency] private IServerNetManager _network = default!; @@ -379,7 +378,6 @@ public bool Start(ServerOptions options, Func? logHandlerFactory = _log.GetSawmill("res")); _entityManager.Initialize(); - _mapManager.Initialize(); _serialization.Initialize(); @@ -397,7 +395,6 @@ public bool Start(ServerOptions options, Func? logHandlerFactory = IoCManager.Resolve().Initialize(); _consoleHost.Initialize(); _entityManager.Startup(); - _mapManager.Startup(); _stateManager.Initialize(); _replay.Initialize(); diff --git a/Robust.Server/ServerIoC.cs b/Robust.Server/ServerIoC.cs index 2c26ca5df06..9bda629e414 100644 --- a/Robust.Server/ServerIoC.cs +++ b/Robust.Server/ServerIoC.cs @@ -56,9 +56,6 @@ internal static void RegisterIoC(IDependencyCollection deps) deps.Register(); deps.Register(); deps.Register(); - deps.Register(); - deps.Register(); - deps.Register(); deps.Register(); deps.Register(); deps.Register(); diff --git a/Robust.Shared.IntegrationTests/Map/MapManager_Tests.cs b/Robust.Shared.IntegrationTests/Map/MapManager_Tests.cs deleted file mode 100644 index 12d4a4604e4..00000000000 --- a/Robust.Shared.IntegrationTests/Map/MapManager_Tests.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Numerics; -using NUnit.Framework; -using Robust.Shared.GameObjects; -using Robust.Shared.Map; -using Robust.Shared.Map.Components; -using Robust.UnitTesting.Server; - -namespace Robust.UnitTesting.Shared.Map -{ - [TestFixture, TestOf(typeof(MapManager))] - internal sealed class MapManagerTests - { - private static ISimulation SimulationFactory() - { - var sim = RobustServerSimulation - .NewSimulation() - .InitializeInstance(); - - return sim; - } - - /// - /// When the map manager is restarted, the maps are deleted. - /// - [Test] - public void Restart_ExistingMap_IsRemoved() - { - var sim = SimulationFactory(); - var mapMan = sim.Resolve(); - var entMan = sim.Resolve(); - var mapSys = entMan.System(); - - var mapID = sim.CreateMap().MapId; - - mapMan.Restart(); - - Assert.That(mapSys.MapExists(mapID), Is.False); - } - - /// - /// When the map manager is restarted, the grids are removed. - /// - [Test] - public void Restart_ExistingGrid_IsRemoved() - { - var sim = SimulationFactory(); - var mapMan = sim.Resolve(); - var entMan = sim.Resolve(); - - var mapID = sim.CreateMap().MapId; - var grid = mapMan.CreateGridEntity(mapID); - - mapMan.Restart(); - - Assert.That(entMan.HasComponent(grid), Is.False); - } - - /// - /// When entities are flushed check nullsapce is also culled. - /// - [Test] - public void Restart_NullspaceMap_IsEmptied() - { - var sim = SimulationFactory(); - var entMan = sim.Resolve(); - var oldEntity = entMan.CreateEntityUninitialized(null, MapCoordinates.Nullspace); - entMan.InitializeEntity(oldEntity); - entMan.FlushEntities(); - Assert.That(entMan.Deleted(oldEntity), Is.True); - } - - [Test] - public void Restart_MapEntity_IsRemoved() - { - var sim = SimulationFactory(); - var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); - var entity = entMan.System().CreateMap(); - mapMan.Restart(); - Assert.That((!entMan.EntityExists(entity) ? EntityLifeStage.Deleted : entMan.GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted, Is.True); - } - } -} diff --git a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs index e7b1834b6e4..91e96400c01 100644 --- a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs +++ b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs @@ -24,10 +24,6 @@ public abstract partial class EntitySpawnHelpersTest : RobustIntegrationTest protected SharedTransformSystem Xforms = default!; protected SharedContainerSystem Container = default!; - // Even if unused, content / downstream tests might use this class, so removal would be a breaking change? - [Obsolete("Use MapSystem")] - protected IMapManager MapMan = default!; - protected EntityUid Map; protected MapId MapId; protected EntityUid Parent; // entity parented to the map. @@ -45,7 +41,6 @@ protected async Task Setup() { Server = StartServer(); await Server.WaitIdleAsync(); - MapMan = Server.ResolveDependency(); EntMan = Server.ResolveDependency(); MapSys = EntMan.System(); Xforms = EntMan.System(); diff --git a/Robust.Shared.Scripting/ScriptGlobalsShared.cs b/Robust.Shared.Scripting/ScriptGlobalsShared.cs index a137062b8df..801df76606d 100644 --- a/Robust.Shared.Scripting/ScriptGlobalsShared.cs +++ b/Robust.Shared.Scripting/ScriptGlobalsShared.cs @@ -33,9 +33,6 @@ public abstract partial class ScriptGlobalsShared : IInvocationContext public IEntitySystemManager esm => _esm; [Dependency] private IPrototypeManager _prot = null!; public IPrototypeManager prot => _prot; - [Dependency] private IMapManager _map = null!; - [Obsolete("use SharedMapSystem instead")] - public IMapManager map => _map; [Dependency] private IDependencyCollection _dependencies = null!; public IDependencyCollection dependencies => _dependencies; [Dependency] private ToolshedManager _shed = null!; diff --git a/Robust.Shared/Map/CoordinatesExtensions.cs b/Robust.Shared/Map/CoordinatesExtensions.cs index 3ebd723101f..38c8560efa7 100644 --- a/Robust.Shared/Map/CoordinatesExtensions.cs +++ b/Robust.Shared/Map/CoordinatesExtensions.cs @@ -8,7 +8,7 @@ namespace Robust.Shared.Map { public static class CoordinatesExtensions { - public static EntityCoordinates AlignWithClosestGridTile(this EntityCoordinates coords, float searchBoxSize = 1.5f, IEntityManager? entityManager = null, IMapManager? mapManager = null) + public static EntityCoordinates AlignWithClosestGridTile(this EntityCoordinates coords, float searchBoxSize = 1.5f, IEntityManager? entityManager = null) { IoCManager.Resolve(ref entityManager); diff --git a/Robust.Shared/Map/EntityCoordinates.cs b/Robust.Shared/Map/EntityCoordinates.cs index 14cf623676e..4eaae6b7cea 100644 --- a/Robust.Shared/Map/EntityCoordinates.cs +++ b/Robust.Shared/Map/EntityCoordinates.cs @@ -95,12 +95,6 @@ public static EntityCoordinates FromMap(EntityUid entity, MapCoordinates coordin return transformSystem.ToCoordinates(entity, coordinates); } - [Obsolete("Use SharedTransformSystem.ToCoordinates()")] - public static EntityCoordinates FromMap(IMapManager mapManager, MapCoordinates coordinates) - { - return IoCManager.Resolve().System().ToCoordinates(coordinates); - } - /// /// Converts this set of coordinates to Vector2i. /// @@ -124,15 +118,6 @@ public Vector2i ToVector2i( return new Vector2i((int)MathF.Floor(vec.X), (int)MathF.Floor(vec.Y)); } - [Obsolete("use the version without IMapManager")] - public Vector2i ToVector2i( - IEntityManager entityManager, - IMapManager mapManager, - SharedTransformSystem transformSystem) - { - return ToVector2i(entityManager, transformSystem); - } - /// /// Returns an new set of EntityCoordinates with the same /// but on a different position. diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs deleted file mode 100644 index fad26a165af..00000000000 --- a/Robust.Shared/Map/IMapManager.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Numerics; -using Robust.Shared.GameObjects; -using Robust.Shared.Map.Components; -using Robust.Shared.Maths; -using Robust.Shared.Physics; -using Robust.Shared.Physics.Collision.Shapes; - -namespace Robust.Shared.Map -{ - /// - /// This manages all the grids and maps in the world. Largely superseded by . - /// - [NotContentImplementable] - public interface IMapManager - { - public const bool Approximate = SharedMapSystem.Approximate; - public const bool IncludeMap = SharedMapSystem.IncludeMap; - - /// - /// Should the OnTileChanged event be suppressed? This is useful for initially loading the map - /// so that you don't spam an event for each of the million station tiles. - /// - [Obsolete("use SharedMapSystem")] - bool SuppressOnTileChanged { get; set; } - - /// - /// Starts up the map system. - /// - void Initialize(); - - void Shutdown(); - void Startup(); - - void Restart(); - - [Obsolete("Use MapSystem")] - MapId CreateMap(MapId? mapId = null); - - /// - /// Check whether a map with specified ID exists. - /// - /// The map ID to check existence of. - /// True if the map exists, false otherwise. - [Obsolete("Use MapSystem")] - bool MapExists([NotNullWhen(true)] MapId? mapId); - - /// - /// Returns the map entity ID for a given map, or an invalid entity Id if the map does not exist. - /// - [Obsolete("Use MapSystem")] - EntityUid GetMapEntityId(MapId mapId); - - /// - /// Replaces GetMapEntity()'s throw-on-failure semantics. - /// - [Obsolete("Use MapSystem")] - EntityUid GetMapEntityIdOrThrow(MapId mapId); - - [Obsolete("Use MapSystem")] - IEnumerable GetAllMapIds(); - - [Obsolete("Use MapSystem")] - void DeleteMap(MapId mapId); - - // ReSharper disable once MethodOverloadWithOptionalParameter - [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] - MapGridComponent CreateGrid(MapId currentMapId, ushort chunkSize = 16); - [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] - MapGridComponent CreateGrid(MapId currentMapId, in GridCreateOptions options); - [Obsolete("Use MapSystem.CreateGridEntity(...).Comp")] - MapGridComponent CreateGrid(MapId currentMapId); - [Obsolete("Use MapSystem")] - Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null); - [Obsolete("Use MapSystem")] - Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null); - - [Obsolete("Use MapSystem")] - IEnumerable GetAllMapGrids(MapId mapId); - - [Obsolete("Use MapSystem")] - IEnumerable> GetAllGrids(MapId mapId); - - #region MapId - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, - ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, GridCallback callback, - bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, GridCallback callback, bool approx = Approximate, - bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref TState state, - GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref List> grids, - bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, GridCallback callback, - bool approx = Approximate, - bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref TState state, - GridCallback callback, - bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List> grids, - bool approx = Approximate, bool includeMap = IncludeMap); - - #endregion - - #region MapEnt - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, GridCallback callback, - bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, - ref TState state, GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; - - /// - /// Returns true if any grids overlap the specified shapes. - /// - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, List shapes, Transform transform, - ref List> entities, bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, - ref List> grids, bool approx = Approximate, bool includeMap = IncludeMap) where T : IPhysShape; - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, GridCallback callback, - bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref TState state, - GridCallback callback, bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref List> grids, - bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, - bool approx = Approximate, - bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref TState state, - GridCallback callback, - bool approx = Approximate, bool includeMap = IncludeMap); - - [Obsolete("Use MapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, - ref List> grids, - bool approx = Approximate, bool includeMap = IncludeMap); - - #endregion - - #region TryFindGridAt - - [Obsolete("Use MapSystem")] - public bool TryFindGridAt( - EntityUid mapEnt, - Vector2 worldPos, - out EntityUid uid, - [NotNullWhen(true)] out MapGridComponent? grid); - - /// - /// Attempts to find the map grid under the map location. - /// - [Obsolete("Use MapSystem")] - public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, - [NotNullWhen(true)] out MapGridComponent? grid); - - /// - /// Attempts to find the map grid under the map location. - /// - [Obsolete("Use MapSystem")] - public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, - [NotNullWhen(true)] out MapGridComponent? grid); - - #endregion - - #region Obsolete - - [Obsolete] - public bool TryFindGridAt(MapId mapId, Vector2 worldPos, EntityQuery query, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) - { - return TryFindGridAt(mapId, worldPos, out uid, out grid); - } - - [Obsolete] - public IEnumerable FindGridsIntersecting(MapId mapId, Box2 worldAabb, bool approx = false, bool includeMap = true) - { - var grids = new List>(); - FindGridsIntersecting(mapId, worldAabb, ref grids, approx, includeMap); - - foreach (var grid in grids) - { - yield return grid.Comp; - } - } - - [Obsolete] - public IEnumerable FindGridsIntersecting(MapId mapId, Box2Rotated worldArea, bool approx = false, bool includeMap = true) - { - var grids = new List>(); - FindGridsIntersecting(mapId, worldArea, ref grids, approx, includeMap); - - foreach (var grid in grids) - { - yield return grid.Comp; - } - } - - #endregion - - - [Obsolete("Just delete the grid entity")] - void DeleteGrid(EntityUid euid); - - [Obsolete("Use HasComp")] - bool IsGrid(EntityUid uid); - - [Obsolete("Use HasComp")] - bool IsMap(EntityUid uid); - - // - // Pausing functions - // - - [Obsolete("Use MapSystem")] - void SetMapPaused(MapId mapId, bool paused); - - [Obsolete("Use MapSystem")] - void DoMapInitialize(MapId mapId); - - [Obsolete("Use MapSystem")] - bool IsMapPaused(MapId mapId); - - [Obsolete("Use MapSystem")] - bool IsMapInitialized(MapId mapId); - } -} diff --git a/Robust.Shared/Map/IMapManagerInternal.cs b/Robust.Shared/Map/IMapManagerInternal.cs deleted file mode 100644 index c2b19a20f21..00000000000 --- a/Robust.Shared/Map/IMapManagerInternal.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Robust.Shared.GameObjects; -using Robust.Shared.Map.Components; -using Robust.Shared.Maths; - -namespace Robust.Shared.Map -{ - /// - [Obsolete] - internal interface IMapManagerInternal : IMapManager - { - /// - /// Raises the OnTileChanged event. - /// - /// A reference to the new tile. - /// The old tile that got replaced. - [Obsolete("use SharedMapSystem")] - void RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk); - } -} diff --git a/Robust.Shared/Map/MapId.cs b/Robust.Shared/Map/MapId.cs index 4045791de7c..e8848ee8f36 100644 --- a/Robust.Shared/Map/MapId.cs +++ b/Robust.Shared/Map/MapId.cs @@ -11,7 +11,6 @@ namespace Robust.Shared.Map /// All maps, aside from , are also entities. When writing generic code it's usually /// preferable to use or instead. /// - /// /// [Serializable, NetSerializable] public readonly struct MapId : IEquatable diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs deleted file mode 100644 index 75502418251..00000000000 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using Robust.Shared.GameObjects; -using Robust.Shared.Map.Components; -using Robust.Shared.Maths; -using Robust.Shared.Utility; - -namespace Robust.Shared.Map; -internal partial class MapManager -{ - // ReSharper disable once MethodOverloadWithOptionalParameter - [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] - public MapGridComponent CreateGrid(MapId currentMapId, ushort chunkSize = 16) - { - return CreateGridEntity(currentMapId, options: GridCreateOptions.Default with { ChunkSize = chunkSize }).Comp; - } - - [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] - public MapGridComponent CreateGrid(MapId currentMapId, in GridCreateOptions options) - { - return CreateGridEntity(currentMapId, options: options).Comp; - } - - [Obsolete("use SharedMapSystem.CreateGridEntity(...).Comp")] - public MapGridComponent CreateGrid(MapId currentMapId) - { - return CreateGridEntity(currentMapId, options: GridCreateOptions.Default).Comp; - } - - [Obsolete("use SharedMapSystem.CreateGridEntity")] - public Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null) - { - return MapSystem.CreateGridEntity(currentMapId, options: options); - } - - [Obsolete("use SharedMapSystem.CreateGridEntity")] - public Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null) - { - return MapSystem.CreateGridEntity(map, options: options); - } - - [Obsolete("Use HasComponent(uid)")] - public bool IsGrid(EntityUid uid) - { - return EntityManager.HasComponent(uid); - } - - [Obsolete("use SharedMapSystem.GetAllMapGrids")] - public IEnumerable GetAllMapGrids(MapId mapId) - { - return MapSystem.GetAllMapGrids(mapId); - } - - [Obsolete("use SharedMapSystem.GetAllGrids")] - public IEnumerable> GetAllGrids(MapId mapId) - { - return MapSystem.GetAllGrids(mapId); - } - - [Obsolete("just delete the grid entity")] - public virtual void DeleteGrid(EntityUid euid) - { - // Possible the grid was already deleted / is invalid - if (!EntityManager.TryGetComponent(euid, out var iGrid)) - { - DebugTools.Assert($"Calling {nameof(DeleteGrid)} with unknown uid {euid}."); - return; // Silently fail on release - } - - if (!EntityManager.TryGetComponent(euid, out MetaDataComponent? metaComp)) - { - DebugTools.Assert($"Calling {nameof(DeleteGrid)} with {euid}, but there was no allocated entity."); - return; // Silently fail on release - } - - // DeleteGrid may be triggered by the entity being deleted, - // so make sure that's not the case. - if (metaComp.EntityLifeStage < EntityLifeStage.Terminating) - EntityManager.DeleteEntity(euid); - } - - /// - [Obsolete("use SharedMapSystem.SuppressOnTileChanged")] - public bool SuppressOnTileChanged - { - get => MapSystem.SuppressOnTileChanged; - set { MapSystem.SuppressOnTileChanged = value; } - } - - /// - /// Raises the OnTileChanged event. - /// - /// A reference to the new tile. - /// The old tile that got replaced. - [Obsolete("use SharedMapSystem.RaiseOnTileChanged")] - void IMapManagerInternal.RaiseOnTileChanged(Entity entity, TileRef tileRef, Tile oldTile, Vector2i chunk) - { - MapSystem.RaiseOnTileChanged(entity, tileRef, oldTile, chunk); - } -} diff --git a/Robust.Shared/Map/MapManager.MapCollection.cs b/Robust.Shared/Map/MapManager.MapCollection.cs deleted file mode 100644 index 3810652f9a4..00000000000 --- a/Robust.Shared/Map/MapManager.MapCollection.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Robust.Shared.GameObjects; -using Robust.Shared.Map.Components; - -namespace Robust.Shared.Map; - -/// -/// Arguments for when a map is created or deleted locally ore remotely. -/// -public sealed class MapEventArgs : EventArgs -{ - /// - /// Creates a new instance of this class. - /// - public MapEventArgs(MapId map) - { - Map = map; - } - - /// - /// Map that is being modified. - /// - public MapId Map { get; } -} - -internal partial class MapManager -{ - /// - public virtual void DeleteMap(MapId mapId) - { - MapSystem.DeleteMap(mapId); - } - - /// - public MapId CreateMap(MapId? mapId = null) - { - if (mapId != null) - { - MapSystem.CreateMap(mapId.Value); - return mapId.Value; - } - - MapSystem.CreateMap(out var map); - return map; - } - - /// - public bool MapExists([NotNullWhen(true)] MapId? mapId) - { - return MapSystem.MapExists(mapId); - } - - /// - public EntityUid GetMapEntityId(MapId mapId) - { - return MapSystem.GetMapOrInvalid(mapId); - } - - /// - /// Replaces GetMapEntity()'s throw-on-failure semantics. - /// - public EntityUid GetMapEntityIdOrThrow(MapId mapId) - { - return MapSystem.GetMap(mapId); - } - - public bool TryGetMap([NotNullWhen(true)] MapId? mapId, [NotNullWhen(true)] out EntityUid? uid) - { - return MapSystem.TryGetMap(mapId, out uid); - } - - /// - public IEnumerable GetAllMapIds() - { - return MapSystem.GetAllMapIds(); - } - - /// - public bool IsMap(EntityUid uid) - { - return EntityManager.HasComponent(uid); - } -} diff --git a/Robust.Shared/Map/MapManager.Pause.cs b/Robust.Shared/Map/MapManager.Pause.cs deleted file mode 100644 index 35415537c4a..00000000000 --- a/Robust.Shared/Map/MapManager.Pause.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Globalization; -using Robust.Shared.GameObjects; - -namespace Robust.Shared.Map -{ - internal partial class MapManager - { - public void SetMapPaused(MapId mapId, bool paused) - { - MapSystem.SetPaused(mapId, paused); - } - - public void SetMapPaused(EntityUid uid, bool paused) - { - MapSystem.SetPaused(uid, paused); - } - - public void DoMapInitialize(MapId mapId) - { - MapSystem.InitializeMap(mapId); - } - - public bool IsMapInitialized(MapId mapId) - { - return MapSystem.IsInitialized(mapId); - } - - /// - public bool IsMapPaused(MapId mapId) - { - return MapSystem.IsPaused(mapId); - } - - /// - public bool IsMapPaused(EntityUid uid) - { - return MapSystem.IsPaused(uid); - } - } -} diff --git a/Robust.Shared/Map/MapManager.Queries.cs b/Robust.Shared/Map/MapManager.Queries.cs deleted file mode 100644 index 8916fa76d84..00000000000 --- a/Robust.Shared/Map/MapManager.Queries.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Numerics; -using Robust.Shared.GameObjects; -using Robust.Shared.Map.Components; -using Robust.Shared.Maths; -using Robust.Shared.Physics; -using Robust.Shared.Physics.Collision.Shapes; - -namespace Robust.Shared.Map; - -internal partial class MapManager -{ - #region MapId [Obsolete] - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, - ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapId, shape, transform, ref grids, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, T shape, Transform transform, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapId, shape, transform, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldAABB, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2 worldAABB, ref List> grids, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldAABB, ref grids, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldBounds, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref TState state, GridCallback callback, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(MapId mapId, Box2Rotated worldBounds, ref List> grids, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapId, worldBounds, ref grids, approx: approx, includeMap: includeMap); - } - - #endregion - - #region MapEnt [Obsolete] - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting( - EntityUid mapEnt, - T shape, - Transform transform, - GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapEnt, shape, transform, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting( - EntityUid mapEnt, - T shape, - Transform transform, - ref TState state, - GridCallback callback, - bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref state, callback, approx: approx, includeMap: includeMap); - } - - /// - /// Returns true if any grids overlap the specified shapes. - /// - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, List shapes, Transform transform, ref List> entities, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, shapes, transform, ref entities, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, T shape, Transform transform, - ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapEnt, shape, transform, ref grids, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, T shape, Box2 worldAABB, Transform transform, - ref List> grids, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) where T : IPhysShape - { - MapSystem.FindGridsIntersecting(mapEnt, shape, worldAABB, transform, ref grids, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldAABB, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref TState state, GridCallback callback, bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref state, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2 worldAABB, ref List> grids, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldAABB, ref grids, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, GridCallback callback, bool approx = IMapManager.Approximate, - bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldBounds, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref TState state, GridCallback callback, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref state, callback, approx: approx, includeMap: includeMap); - } - - [Obsolete("use SharedMapSystem")] - public void FindGridsIntersecting(EntityUid mapEnt, Box2Rotated worldBounds, ref List> grids, - bool approx = IMapManager.Approximate, bool includeMap = IMapManager.IncludeMap) - { - MapSystem.FindGridsIntersecting(mapEnt, worldBounds, ref grids, approx: approx, includeMap: includeMap); - } - - #endregion - - #region TryFindGridAt - - [Obsolete("use SharedMapSystem")] - public bool TryFindGridAt( - EntityUid mapEnt, - Vector2 worldPos, - out EntityUid uid, - [NotNullWhen(true)] out MapGridComponent? grid) - { - return MapSystem.TryFindGridAt(mapEnt, worldPos, out uid, out grid); - } - - /// - /// Attempts to find the map grid under the map location. - /// - [Obsolete("use SharedMapSystem")] - public bool TryFindGridAt(MapId mapId, Vector2 worldPos, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) - { - return MapSystem.TryFindGridAt(mapId, worldPos, out uid, out grid); - } - - /// - /// Attempts to find the map grid under the map location. - /// - [Obsolete("use SharedMapSystem")] - public bool TryFindGridAt(MapCoordinates mapCoordinates, out EntityUid uid, [NotNullWhen(true)] out MapGridComponent? grid) - { - return MapSystem.TryFindGridAt(mapCoordinates, out uid, out grid); - } - - #endregion -} diff --git a/Robust.Shared/Map/MapManager.cs b/Robust.Shared/Map/MapManager.cs deleted file mode 100644 index 3bfd5f3e3ce..00000000000 --- a/Robust.Shared/Map/MapManager.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Log; -using Robust.Shared.Map.Components; - -namespace Robust.Shared.Map; - -/// -[Virtual] -internal partial class MapManager : IMapManagerInternal, IEntityEventSubscriber -{ - [Dependency] public IEntityManager EntityManager = default!; - [Dependency] private ILogManager _logManager = default!; - - private ISawmill _sawmill = default!; - - protected SharedMapSystem MapSystem = default!; - - /// - public void Initialize() - { - _sawmill = _logManager.GetSawmill("system.map"); - } - - /// - public void Startup() - { - MapSystem = EntityManager.System(); - - _sawmill.Debug("Starting..."); - } - - /// - public void Shutdown() - { - _sawmill.Debug("Stopping..."); - - // TODO: AllEntityQuery instead??? - var query = EntityManager.EntityQueryEnumerator(); - - while (query.MoveNext(out var uid, out _)) - { - EntityManager.DeleteEntity(uid); - } - } - - /// - public void Restart() - { - _sawmill.Debug("Restarting..."); - - // Don't just call Shutdown / Startup because we don't want to touch the subscriptions on gridtrees - // Restart can be called any time during a game, whereas shutdown / startup are typically called upon connection. - var query = EntityManager.EntityQueryEnumerator(); - - while (query.MoveNext(out var uid, out _)) - { - EntityManager.DeleteEntity(uid); - } - } -} diff --git a/Robust.Shared/Map/NetworkedMapManager.cs b/Robust.Shared/Map/NetworkedMapManager.cs deleted file mode 100644 index fdfbfadf781..00000000000 --- a/Robust.Shared/Map/NetworkedMapManager.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Robust.Shared.Timing; - -namespace Robust.Shared.Map; - -[Obsolete] -internal interface INetworkedMapManager : IMapManagerInternal -{ - [Obsolete] - void CullDeletionHistory(GameTick upToTick); -} - -[Obsolete] -internal sealed class NetworkedMapManager : MapManager, INetworkedMapManager -{ - [Obsolete] - public void CullDeletionHistory(GameTick upToTick) - { - MapSystem.CullDeletionHistory(upToTick); - } -} diff --git a/Robust.UnitTesting/IIntegrationInstance.cs b/Robust.UnitTesting/IIntegrationInstance.cs index 63a07de61ce..5585120fb83 100644 --- a/Robust.UnitTesting/IIntegrationInstance.cs +++ b/Robust.UnitTesting/IIntegrationInstance.cs @@ -31,8 +31,6 @@ public interface IIntegrationInstance : IDisposable IConfigurationManager CfgMan { get; } ISharedPlayerManager PlayerMan { get; } INetManager NetMan { get; } - [Obsolete("use SharedMapSystem")] - IMapManager MapMan { get; } IGameTiming Timing { get; } ISawmill Log { get; } diff --git a/Robust.UnitTesting/RobustIntegrationTest.cs b/Robust.UnitTesting/RobustIntegrationTest.cs index 9dac3b619f9..ab299c4ab56 100644 --- a/Robust.UnitTesting/RobustIntegrationTest.cs +++ b/Robust.UnitTesting/RobustIntegrationTest.cs @@ -323,8 +323,6 @@ public abstract class IntegrationInstance : IIntegrationInstance public ISharedPlayerManager PlayerMan { get; private set; } = default!; public INetManager NetMan { get; private set; } = default!; public IGameTiming Timing { get; private set; } = default!; - [Obsolete("use SharedMapSystem")] - public IMapManager MapMan { get; private set; } = default!; public IConsoleHost ConsoleHost { get; private set; } = default!; public ISawmill Log { get; private set; } = default!; @@ -336,7 +334,6 @@ protected virtual void ResolveIoC(IDependencyCollection deps) PlayerMan = deps.Resolve(); Timing = deps.Resolve(); NetMan = deps.Resolve(); - MapMan = deps.Resolve(); ConsoleHost = deps.Resolve(); Log = deps.Resolve().GetSawmill("test"); } diff --git a/Robust.UnitTesting/RobustUnitTest.cs b/Robust.UnitTesting/RobustUnitTest.cs index 71e63806ac7..bdfc90ed64f 100644 --- a/Robust.UnitTesting/RobustUnitTest.cs +++ b/Robust.UnitTesting/RobustUnitTest.cs @@ -161,7 +161,6 @@ public void BaseSetup() } var entMan = deps.Resolve(); - var mapMan = deps.Resolve(); // Avoid discovering EntityCommands since they may depend on systems // that aren't available in a unit test context. @@ -193,7 +192,6 @@ public void BaseSetup() // RobustUnitTest is complete hot garbage. // This makes EventTables ignore *all* the screwed up component abuse it causes. entMan.EventBus.OnlyCallOnRobustUnitTestISwearToGodPleaseSomebodyKillThisNightmare(); // The nightmare never ends - mapMan.Initialize(); systems.Initialize(); deps.Resolve().LoadAssemblies(assemblies); @@ -203,7 +201,6 @@ public void BaseSetup() modLoader.TryLoadModulesFrom(ResPath.Root, ""); entMan.Startup(); - mapMan.Startup(); } [OneTimeTearDown] From 04dccdef1d01f980846b477b76358ba26b285036 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 23:18:40 -0700 Subject: [PATCH 18/21] Private internal FindGridsIntersecting method --- .../GameObjects/Systems/SharedMapSystem.Grid.Queries.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs index ae3165b0543..4d754b59031 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs @@ -457,8 +457,7 @@ public IEnumerable GetAllMapGrids(MapId mapId) /// The shape of the region to check. /// The world-local axis aligned bounding box of the region to check. /// The transform, relative to the map, of the region to check. - [Access(typeof(MapManager), Other = AccessPermissions.None)] - public void FindGridsIntersecting( + private void FindGridsIntersecting( EntityUid mapEnt, TShape shape, Box2 worldAABB, From cd29e9a2f69240da7db361d17fd078d52f0b4678 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 23:29:32 -0700 Subject: [PATCH 19/21] please die --- Robust.Shared/Map/Components/MapComponent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/Map/Components/MapComponent.cs b/Robust.Shared/Map/Components/MapComponent.cs index 3633ad41cbd..5fae7461a3a 100644 --- a/Robust.Shared/Map/Components/MapComponent.cs +++ b/Robust.Shared/Map/Components/MapComponent.cs @@ -18,10 +18,10 @@ public sealed partial class MapComponent : Component [ViewVariables(VVAccess.ReadOnly), Access(typeof(SharedMapSystem), Other = AccessPermissions.ReadExecute)] public MapId MapId { get; internal set; } = MapId.Nullspace; - [DataField, Access(typeof(SharedMapSystem), typeof(MapManager))] + [DataField, Access(typeof(SharedMapSystem))] public bool MapPaused; - [DataField, Access(typeof(SharedMapSystem), typeof(MapManager))] + [DataField, Access(typeof(SharedMapSystem))] public bool MapInitialized; } From 1fc4ff69c003caf159b4d96328a1d0ce87844a68 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Tue, 19 May 2026 23:35:49 -0700 Subject: [PATCH 20/21] 41 --- Robust.Client/GameController/GameController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Client/GameController/GameController.cs b/Robust.Client/GameController/GameController.cs index 51189bbeb9a..52f29e12bcd 100644 --- a/Robust.Client/GameController/GameController.cs +++ b/Robust.Client/GameController/GameController.cs @@ -147,7 +147,7 @@ internal bool StartupContinue(DisplayMode displayMode) { DebugTools.AssertNotNull(_resourceManifest); - _loadscr.Initialize(42); + _loadscr.Initialize(41); _loadscr.BeginLoadingSection("Init graphics", dontRender: true); _clyde.InitializePostWindowing(); From 6e0665c2d05ace02f19d5927d2e1ce10d379b245 Mon Sep 17 00:00:00 2001 From: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> Date: Wed, 1 Jul 2026 19:05:44 -0700 Subject: [PATCH 21/21] notes --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3452613dab2..eb70de8e6ff 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -36,6 +36,7 @@ END TEMPLATE--> ### Breaking changes * Validate UIBox2i inputs +* IMapManager has been completely nuked from the codebase. Almost all of its content-facing functionality was ported to `SharedMapSystem` in https://github.com/space-wizards/RobustToolbox/pull/6579 beforehand. ### New features