From f2625bf5c5dba922184b66783f1ca6cf7279d8cb Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 1 Jul 2026 19:32:17 -0700 Subject: [PATCH] Removes IMapManager (#6584) * 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 * 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 * Move RaiseOnTileChanged to SharedMapSystem Also moves the SuppressOnTileChanged flag member to SharedMapSystem Hollows out and obsoletes the MapManager versions * Move default value constants to SharedMapSystem * Converts map pausing events into LocalizedEntityCommands * 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 * Move CullDeletionHistory to SharedMapSystem Well, that was less painful than I thought it would be * Actually obsolete the NetworkedMapManager method * Rename file * Doc comments for new SharedMapSystem methods * Doc comment * Doc comments * Fix access * Purge all references to IMapManagerInternal * Cull easy IMapManager references * The rest * Purge IMapManager * Private internal FindGridsIntersecting method * please die * 41 * notes --------- Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> --- RELEASE-NOTES.md | 1 + .../Transform/RecursiveMoveBenchmark.cs | 3 +- .../Components/TransformComponentTests.cs | 9 +- Robust.Client/BaseClient.cs | 3 - Robust.Client/ClientIoC.cs | 3 - Robust.Client/Console/Commands/Debug.cs | 3 +- .../Debugging/DebugAnchoringSystem.cs | 3 +- Robust.Client/Debugging/DebugPhysicsSystem.cs | 14 +- .../Debugging/Overlays/TileDebugOverlay.cs | 5 +- .../GameController/GameController.cs | 4 +- .../EntitySystems/DebugLightTreeSystem.cs | 8 +- .../GridChunkBoundsDebugSystem.cs | 13 +- .../Graphics/Clyde/Clyde.GridRendering.cs | 11 +- Robust.Client/Graphics/Clyde/Clyde.cs | 1 - Robust.Client/Physics/GridFixtureSystem.cs | 9 +- Robust.Client/Placement/IPlacementManager.cs | 1 - Robust.Client/Placement/Modes/AlignTileAny.cs | 2 +- Robust.Client/Placement/PlacementManager.cs | 2 - Robust.Client/Placement/PlacementMode.cs | 5 +- .../DebugMonitorControls/DebugCoordsPanel.cs | 5 +- .../Editors/VVPropEditorEntityCoordinates.cs | 1 - .../GameObjects/Components/Container_Test.cs | 6 +- .../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 +- .../RobustServerSimulation.cs | 7 - Robust.Server/BaseServer.cs | 3 - Robust.Server/Physics/GridFixtureSystem.cs | 3 +- Robust.Server/Placement/PlacementManager.cs | 13 +- Robust.Server/ServerIoC.cs | 3 - .../EntityLookup_Test.cs | 31 +-- .../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 | 9 +- .../GameObjects/TransformComponent_Tests.cs | 3 +- .../GameState/DeletionNetworkingTests.cs | 5 +- .../Map/EntityCoordinates_Tests.cs | 25 +- .../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/MapManager_Tests.cs | 83 ------ .../Map/MapPauseTests.cs | 13 +- .../Map/Query_Tests.cs | 5 +- .../Map/SingleTileRemoveTest.cs | 3 +- .../Physics/BroadphaseNetworkingTest.cs | 5 +- .../Physics/Broadphase_Test.cs | 19 +- .../Physics/CollisionWake_Test.cs | 3 +- .../Physics/GridDeletion_Test.cs | 8 +- .../Physics/GridMovement_Test.cs | 3 +- .../Physics/GridReparentVelocity_Test.cs | 4 +- .../Physics/JointDeletion_Test.cs | 1 - .../Physics/MapVelocity_Test.cs | 10 +- .../Physics/RayCast_Test.cs | 2 +- .../Physics/RecursiveUpdateTest.cs | 6 +- .../Physics/Stack_Test.cs | 1 - .../Prototypes/HotReloadTest.cs | 2 - .../Spawning/EntitySpawnHelpersTest.cs | 4 - .../TransformTests/GridTraversalTest.cs | 3 +- .../ScriptGlobalsShared.cs | 2 - .../ComponentTrees/ComponentTreeSystem.cs | 3 +- Robust.Shared/Console/Commands/MapCommands.cs | 3 +- .../Console/Commands/TeleportCommands.cs | 3 +- .../EntitySerialization/MapChunkSerializer.cs | 13 +- .../Transform/TransformComponent.cs | 4 +- Robust.Shared/GameObjects/EntityManager.cs | 3 +- .../Systems/EntityLookup.Queries.cs | 8 +- .../EntityLookupSystem.ComponentQueries.cs | 6 +- .../GameObjects/Systems/EntityLookupSystem.cs | 1 - .../Systems/SharedGridTraversalSystem.cs | 4 +- .../Systems/SharedMapSystem.Coordinates.cs | 2 +- .../Systems/SharedMapSystem.Grid.Queries.cs | 3 +- .../GameObjects/Systems/SharedMapSystem.cs | 2 - .../SharedTransformSystem.Component.cs | 12 +- .../Systems/SharedTransformSystem.cs | 1 - Robust.Shared/Map/Components/MapComponent.cs | 4 +- Robust.Shared/Map/CoordinatesExtensions.cs | 8 +- Robust.Shared/Map/EntityCoordinates.cs | 7 - 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 -- .../Physics/Systems/SharedBroadphaseSystem.cs | 13 +- Robust.UnitTesting/IIntegrationInstance.cs | 1 - Robust.UnitTesting/Pool/TestPair.Helpers.cs | 2 +- Robust.UnitTesting/RobustIntegrationTest.cs | 2 - Robust.UnitTesting/RobustUnitTest.cs | 3 - 103 files changed, 207 insertions(+), 1222 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/RELEASE-NOTES.md b/RELEASE-NOTES.md index f0979fb06c..1c3acc246a 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 diff --git a/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs b/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs index 15acf56523..1f67c1a548 100644 --- a/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs +++ b/Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs @@ -47,7 +47,6 @@ public class RecursiveMoveBenchmark : RobustIntegrationTest 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 class RecursiveMoveBenchmark : RobustIntegrationTest 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.IntegrationTests/GameObjects/Components/TransformComponentTests.cs b/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs index 0f5a3e3c28..1b774095a6 100644 --- a/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs +++ b/Robust.Client.IntegrationTests/GameObjects/Components/TransformComponentTests.cs @@ -19,12 +19,13 @@ namespace Robust.UnitTesting.Client.GameObjects.Components .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/BaseClient.cs b/Robust.Client/BaseClient.cs index 428ab9859c..4c8dbf89e2 100644 --- a/Robust.Client/BaseClient.cs +++ b/Robust.Client/BaseClient.cs @@ -26,7 +26,6 @@ namespace Robust.Client [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 @@ namespace Robust.Client private void GameStartedSetup() { _entityManager.Startup(); - _mapManager.Startup(); _timing.ResetSimTime(_timeBase); _timing.Paused = false; @@ -259,7 +257,6 @@ namespace Robust.Client _gameStates.Reset(); _playMan.Shutdown(); _entityManager.Shutdown(); - _mapManager.Shutdown(); _discord.ClearPresence(); Reset(); } diff --git a/Robust.Client/ClientIoC.cs b/Robust.Client/ClientIoC.cs index 3df8484504..7a2ca8e14f 100644 --- a/Robust.Client/ClientIoC.cs +++ b/Robust.Client/ClientIoC.cs @@ -66,9 +66,6 @@ namespace Robust.Client deps.Register(); deps.Register(); deps.Register(); - deps.Register(); - deps.Register(); - deps.Register(); deps.Register(); deps.Register(); deps.Register(); diff --git a/Robust.Client/Console/Commands/Debug.cs b/Robust.Client/Console/Commands/Debug.cs index 3d8c0ed0a0..1d21498e12 100644 --- a/Robust.Client/Console/Commands/Debug.cs +++ b/Robust.Client/Console/Commands/Debug.cs @@ -718,7 +718,6 @@ namespace Robust.Client.Console.Commands 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 @@ namespace Robust.Client.Console.Commands { 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 0446aa7b67..75c6d07b7e 100644 --- a/Robust.Client/Debugging/DebugAnchoringSystem.cs +++ b/Robust.Client/Debugging/DebugAnchoringSystem.cs @@ -17,7 +17,6 @@ namespace Robust.Client.Debugging { [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 @@ namespace Robust.Client.Debugging 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/DebugPhysicsSystem.cs b/Robust.Client/Debugging/DebugPhysicsSystem.cs index d34944a415..df1e357be7 100644 --- a/Robust.Client/Debugging/DebugPhysicsSystem.cs +++ b/Robust.Client/Debugging/DebugPhysicsSystem.cs @@ -84,7 +84,7 @@ namespace Robust.Client.Debugging [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 @@ namespace Robust.Client.Debugging EntityManager, _eye, _input, - _map, _player, _resourceCache, this, _entityLookup, _physics, - _transform)); + _transform, + _map)); if (value == PhysicsDebugFlags.None) _overlay.RemoveOverlay(typeof(PhysicsDebugOverlay)); @@ -203,12 +203,12 @@ namespace Robust.Client.Debugging 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,17 +219,17 @@ namespace Robust.Client.Debugging 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); } @@ -293,7 +293,7 @@ namespace Robust.Client.Debugging } _grids.Clear(); - _mapManager.FindGridsIntersecting(mapId, viewBounds, ref _grids); + _mapSystem.FindGridsIntersecting(mapId, viewBounds, ref _grids); foreach (var grid in _grids) { diff --git a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs index 74779c8ecc..d3f1df1639 100644 --- a/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs +++ b/Robust.Client/Debugging/Overlays/TileDebugOverlay.cs @@ -25,7 +25,6 @@ public abstract partial class TileDebugOverlay : Overlay, IPostInjectInit { [Dependency] protected IEntityManager Entity = default!; [Dependency] protected IEyeManager Eye = default!; - [Dependency] protected IMapManager MapMan = default!; [Dependency] protected IInputManager Input = default!; [Dependency] protected IUserInterfaceManager Ui = default!; [Dependency] protected IResourceCache Cache = default!; @@ -59,7 +58,7 @@ public abstract partial class TileDebugOverlay : Overlay, IPostInjectInit 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 +107,7 @@ public abstract partial class TileDebugOverlay : Overlay, IPostInjectInit 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/GameController/GameController.cs b/Robust.Client/GameController/GameController.cs index 1071ea0df4..52f29e12bc 100644 --- a/Robust.Client/GameController/GameController.cs +++ b/Robust.Client/GameController/GameController.cs @@ -61,7 +61,6 @@ namespace Robust.Client [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!; @@ -148,7 +147,7 @@ namespace Robust.Client { DebugTools.AssertNotNull(_resourceManifest); - _loadscr.Initialize(42); + _loadscr.Initialize(41); _loadscr.BeginLoadingSection("Init graphics", dontRender: true); _clyde.InitializePostWindowing(); @@ -236,7 +235,6 @@ namespace Robust.Client _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/GameObjects/EntitySystems/DebugLightTreeSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs index cc41a5482e..c50fa091e6 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs @@ -27,8 +27,6 @@ namespace Robust.Client.GameObjects { _lightOverlay = new DebugLightOverlay( EntityManager.System(), - IoCManager.Resolve(), - IoCManager.Resolve(), EntityManager.System()); overlayManager.AddOverlay(_lightOverlay); @@ -46,18 +44,14 @@ namespace Robust.Client.GameObjects private sealed class DebugLightOverlay : Overlay { private EntityLookupSystem _lookup; - private IEyeManager _eyeManager; - private IMapManager _mapManager; private LightTreeSystem _trees; public override OverlaySpace Space => OverlaySpace.WorldSpace; - public DebugLightOverlay(EntityLookupSystem lookup, IEyeManager eyeManager, IMapManager mapManager, LightTreeSystem trees) + public DebugLightOverlay(EntityLookupSystem lookup, 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 1a60f7bd9e..761244b9b5 100644 --- a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs @@ -4,7 +4,6 @@ using Robust.Client.Graphics; 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 @@ namespace Robust.Client.GameObjects DebugTools.Assert(_overlay == null); _overlay = new GridChunkBoundsOverlay( EntityManager, - _eyeManager, - _mapManager, _transform, _map); @@ -58,8 +53,6 @@ namespace Robust.Client.GameObjects 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; @@ -67,11 +60,9 @@ namespace Robust.Client.GameObjects 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; - _eyeManager = eyeManager; - _mapManager = mapManager; _transformSystem = transformSystem; _mapSystem = mapSystem; } @@ -84,7 +75,7 @@ namespace Robust.Client.GameObjects 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 933eb05b77..d47ba808ec 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs @@ -52,19 +52,18 @@ namespace Robust.Client.Graphics.Clyde 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 @@ namespace Robust.Client.Graphics.Clyde } 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 @@ namespace Robust.Client.Graphics.Clyde // 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 @@ namespace Robust.Client.Graphics.Clyde } } - 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 fc03dd5ed8..9cad353b87 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.cs @@ -37,7 +37,6 @@ namespace Robust.Client.Graphics.Clyde [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 9907f81ef0..ac42b07736 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 @@ namespace Robust.Client.Physics if (_enableDebug) { - var overlay = new GridSplitNodeOverlay(_mapManager, this, _transform, _map); + var overlay = new GridSplitNodeOverlay(this, _transform, _map); _overlay.AddOverlay(overlay); RaiseNetworkEvent(new RequestGridNodesMessage()); } @@ -72,14 +71,12 @@ namespace Robust.Client.Physics { 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) + public GridSplitNodeOverlay(GridFixtureSystem system, SharedTransformSystem transform, SharedMapSystem map) { - _mapManager = mapManager; _system = system; _transform = transform; _map = map; @@ -91,7 +88,7 @@ namespace Robust.Client.Physics 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.Client/Placement/IPlacementManager.cs b/Robust.Client/Placement/IPlacementManager.cs index 15b8f09167..756521b2e1 100644 --- a/Robust.Client/Placement/IPlacementManager.cs +++ b/Robust.Client/Placement/IPlacementManager.cs @@ -24,7 +24,6 @@ namespace Robust.Client.Placement IEntityManager EntityManager { get; } IEyeManager EyeManager { get; } - IMapManager MapManager { get; } /// /// The direction to spawn the entity in (presently exposed for EntitySpawnWindow UI) diff --git a/Robust.Client/Placement/Modes/AlignTileAny.cs b/Robust.Client/Placement/Modes/AlignTileAny.cs index ff51aa89eb..9523b22951 100644 --- a/Robust.Client/Placement/Modes/AlignTileAny.cs +++ b/Robust.Client/Placement/Modes/AlignTileAny.cs @@ -17,7 +17,7 @@ namespace Robust.Client.Placement.Modes // 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 f2828a08ee..b5ec4a6c9a 100644 --- a/Robust.Client/Placement/PlacementManager.cs +++ b/Robust.Client/Placement/PlacementManager.cs @@ -33,7 +33,6 @@ namespace Robust.Client.Placement [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!; @@ -49,7 +48,6 @@ namespace Robust.Client.Placement public IEntityManager EntityManager => _entityManager; public IEyeManager EyeManager => _eyeManager; - public IMapManager MapManager => _mapManager; private ISawmill _sawmill = default!; diff --git a/Robust.Client/Placement/PlacementMode.cs b/Robust.Client/Placement/PlacementMode.cs index 8ca0de2bd4..810ec1f022 100644 --- a/Robust.Client/Placement/PlacementMode.cs +++ b/Robust.Client/Placement/PlacementMode.cs @@ -201,7 +201,7 @@ namespace Robust.Client.Placement 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 @@ namespace Robust.Client.Placement { 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 86ff546fb2..f4d643d564 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugMonitorControls/DebugCoordsPanel.cs @@ -19,7 +19,6 @@ namespace Robust.Client.UserInterface.CustomControls.DebugMonitorControls [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 @@ namespace Robust.Client.UserInterface.CustomControls.DebugMonitorControls 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 @@ namespace Robust.Client.UserInterface.CustomControls.DebugMonitorControls 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 91620f5b54..840cd81de8 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs @@ -63,7 +63,6 @@ namespace Robust.Client.ViewVariables.Editors 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 87f39f7a05..175551d45d 100644 --- a/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs +++ b/Robust.Server.IntegrationTests/GameObjects/Components/Container_Test.cs @@ -182,9 +182,11 @@ namespace Robust.Server.IntegrationTests.GameObjects.Components 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.IntegrationTests/GameObjects/Components/Transform_Test.cs b/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs index 14f54d4647..6dcf87edb0 100644 --- a/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs +++ b/Robust.Server.IntegrationTests/GameObjects/Components/Transform_Test.cs @@ -19,7 +19,6 @@ namespace Robust.Server.IntegrationTests.GameObjects.Components 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 @@ namespace Robust.Server.IntegrationTests.GameObjects.Components IoCManager.Resolve().GenerateNetIds(); EntityManager = IoCManager.Resolve(); - MapManager = IoCManager.Resolve(); IoCManager.Resolve().Initialize(); var manager = IoCManager.Resolve(); @@ -60,8 +58,8 @@ namespace Robust.Server.IntegrationTests.GameObjects.Components 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 2570fee2d5..4ca55516e0 100644 --- a/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/DetachedParentTest.cs @@ -26,7 +26,6 @@ public sealed class DetachedParentTest : RobustIntegrationTest var mapSys = server.System(); var xformSys = server.System(); - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -72,7 +71,7 @@ public sealed class DetachedParentTest : RobustIntegrationTest 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); @@ -268,7 +267,7 @@ public sealed class DetachedParentTest : RobustIntegrationTest 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; @@ -341,7 +340,7 @@ public sealed class DetachedParentTest : RobustIntegrationTest 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 069001bcae..afaf366fc5 100644 --- a/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/MissingParentTest.cs @@ -20,7 +20,6 @@ public sealed class MissingParentTest : RobustIntegrationTest await using var pair = await StartConnectedPair(); var (client, server) = pair; - 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 3a94114343..e4e92f9e77 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsChunkTest.cs @@ -19,7 +19,6 @@ public sealed class PvsChunkTest : RobustIntegrationTest await using var pair = await StartConnectedPair(); var (client, server) = pair; - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -63,7 +62,7 @@ public sealed class PvsChunkTest : RobustIntegrationTest 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 d92aa95fbc..6344a734db 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsReEntryTest.cs @@ -25,7 +25,6 @@ public sealed class PvsReEntryTest : RobustIntegrationTest await using var pair = await StartConnectedPair(); var (client, server) = pair; - 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 a6fcb607f4..d592ab0782 100644 --- a/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs +++ b/Robust.Server.IntegrationTests/GameStates/PvsSystemTests.cs @@ -22,7 +22,6 @@ public sealed class PvsSystemTests : RobustIntegrationTest await using var pair = await StartConnectedPair(); var (client, server) = pair; - var mapMan = server.ResolveDependency(); var sEntMan = server.ResolveDependency(); var confMan = server.ResolveDependency(); var sPlayerMan = server.ResolveDependency(); @@ -42,7 +41,7 @@ public sealed class PvsSystemTests : RobustIntegrationTest 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.Testing/RobustServerSimulation.cs b/Robust.Server.Testing/RobustServerSimulation.cs index 66eb92d861..5b6591eabd 100644 --- a/Robust.Server.Testing/RobustServerSimulation.cs +++ b/Robust.Server.Testing/RobustServerSimulation.cs @@ -248,9 +248,6 @@ namespace Robust.UnitTesting.Server container.Register(); container.Register(); container.Register(); - container.Register(); - container.Register(); - container.Register(); container.Register(); container.Register(); container.Register(); @@ -341,11 +338,7 @@ namespace Robust.UnitTesting.Server _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 7275de3726..65c1d2b221 100644 --- a/Robust.Server/BaseServer.cs +++ b/Robust.Server/BaseServer.cs @@ -80,7 +80,6 @@ namespace Robust.Server [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 @@ namespace Robust.Server _log.GetSawmill("res")); _entityManager.Initialize(); - _mapManager.Initialize(); _serialization.Initialize(); @@ -397,7 +395,6 @@ namespace Robust.Server IoCManager.Resolve().Initialize(); _consoleHost.Initialize(); _entityManager.Startup(); - _mapManager.Startup(); _stateManager.Initialize(); _replay.Initialize(); diff --git a/Robust.Server/Physics/GridFixtureSystem.cs b/Robust.Server/Physics/GridFixtureSystem.cs index 873e2e7c31..159a4ca15c 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 @@ namespace Robust.Server.Physics 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.Server/Placement/PlacementManager.cs b/Robust.Server/Placement/PlacementManager.cs index a7868c8730..f4d426f669 100644 --- a/Robust.Server/Placement/PlacementManager.cs +++ b/Robust.Server/Placement/PlacementManager.cs @@ -28,7 +28,6 @@ namespace Robust.Server.Placement [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 @@ namespace Robust.Server.Placement { 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.Server/ServerIoC.cs b/Robust.Server/ServerIoC.cs index 2c26ca5df0..9bda629e41 100644 --- a/Robust.Server/ServerIoC.cs +++ b/Robust.Server/ServerIoC.cs @@ -56,9 +56,6 @@ namespace Robust.Server deps.Register(); deps.Register(); deps.Register(); - deps.Register(); - deps.Register(); - deps.Register(); deps.Register(); deps.Register(); deps.Register(); diff --git a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs index cd06309a60..a6e4b60aa3 100644 --- a/Robust.Shared.IntegrationTests/EntityLookup_Test.cs +++ b/Robust.Shared.IntegrationTests/EntityLookup_Test.cs @@ -65,9 +65,9 @@ namespace Robust.UnitTesting.Shared return ent; } - private Entity SetupGrid(MapId mapId, SharedMapSystem mapSystem, IEntityManager entManager, IMapManager mapManager) + private Entity SetupGrid(MapId mapId, SharedMapSystem mapSystem, IEntityManager entManager) { - 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; @@ -88,11 +88,10 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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 @@ namespace Robust.UnitTesting.Shared 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); @@ -354,12 +346,11 @@ namespace Robust.UnitTesting.Shared 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 3e4b12c25d..f049e1dfd3 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/AutoIncludeSerializationTest.cs @@ -34,7 +34,6 @@ internal sealed partial class AutoIncludeSerializationTest : RobustIntegrationTe 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 @@ internal sealed partial class AutoIncludeSerializationTest : RobustIntegrationTe 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 5b48ec6c1e..aee367cbd3 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/CategorizationTest.cs @@ -35,7 +35,6 @@ internal sealed partial class CategorizationTest : RobustIntegrationTest 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 @@ internal sealed partial class CategorizationTest : RobustIntegrationTest { 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 97f2d94202..aad38625cf 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/MapMergeTest.cs @@ -35,7 +35,6 @@ internal sealed partial class MapMergeTest : RobustIntegrationTest 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 @@ internal sealed partial class MapMergeTest : RobustIntegrationTest 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 2cbb7f1db8..518abaf559 100644 --- a/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs +++ b/Robust.Shared.IntegrationTests/EntitySerialization/OrphanSerializationTest.cs @@ -129,7 +129,6 @@ internal sealed partial class OrphanSerializationTest : RobustIntegrationTest 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 @@ internal sealed partial class OrphanSerializationTest : RobustIntegrationTest 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 28b38f3f78..8b52fba8d7 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/ContainerTests.cs @@ -161,7 +161,6 @@ namespace Robust.UnitTesting.Shared.GameObjects 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 5bb02e61d2..1b354c9d81 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/DeferredEntityDeletionTest.cs @@ -39,7 +39,6 @@ internal sealed partial class DeferredEntityDeletionTest : RobustIntegrationTest 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 9f04c1f2d5..d3abfc2e0e 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/Systems/AnchoredSystemTests.cs @@ -38,14 +38,14 @@ namespace Robust.UnitTesting.Shared.GameObjects.Systems }) .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. @@ -160,9 +160,8 @@ namespace Robust.UnitTesting.Shared.GameObjects.Systems 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 aeb951a115..01f0559e62 100644 --- a/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs +++ b/Robust.Shared.IntegrationTests/GameObjects/TransformComponent_Tests.cs @@ -54,12 +54,11 @@ namespace Robust.UnitTesting.Shared.GameObjects 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 48b050625d..86c4de18a6 100644 --- a/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs +++ b/Robust.Shared.IntegrationTests/GameState/DeletionNetworkingTests.cs @@ -28,7 +28,6 @@ internal sealed class DeletionNetworkingTests : RobustIntegrationTest 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 @@ internal sealed class DeletionNetworkingTests : RobustIntegrationTest 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 f43ccb44fc..c2c3035dab 100644 --- a/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/EntityCoordinates_Tests.cs @@ -46,7 +46,6 @@ namespace Robust.UnitTesting.Shared.Map 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)); @@ -122,11 +121,11 @@ namespace Robust.UnitTesting.Shared.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)); @@ -152,11 +151,11 @@ namespace Robust.UnitTesting.Shared.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)); @@ -168,11 +167,11 @@ namespace Robust.UnitTesting.Shared.Map 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)); @@ -190,11 +189,11 @@ namespace Robust.UnitTesting.Shared.Map 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)); @@ -241,11 +240,11 @@ namespace Robust.UnitTesting.Shared.Map 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); @@ -263,11 +262,11 @@ namespace Robust.UnitTesting.Shared.Map 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/GridCollision_Test.cs b/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs index b3726f1996..f2c6294ef1 100644 --- a/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs +++ b/Robust.Shared.IntegrationTests/Map/GridCollision_Test.cs @@ -19,7 +19,6 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 a2eb87253f..3256bd6abd 100644 --- a/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs +++ b/Robust.Shared.IntegrationTests/Map/GridContraction_Test.cs @@ -17,13 +17,12 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 f7374c83b6..34c12cd20b 100644 --- a/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridFixtures_Tests.cs @@ -29,8 +29,8 @@ internal sealed class GridFixtures_Tests : RobustIntegrationTest 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 @@ internal sealed class GridFixtures_Tests : RobustIntegrationTest 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 0ff7aa9c4c..fc70be6801 100644 --- a/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridMerge_Tests.cs @@ -40,14 +40,13 @@ internal sealed class GridMerge_Tests 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 @@ internal sealed class GridMerge_Tests 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 d73e86ff9b..c3ca74f10e 100644 --- a/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridRotation_Tests.cs @@ -24,14 +24,13 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 447c4ea947..beca059b30 100644 --- a/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/GridSplit_Tests.cs @@ -31,11 +31,10 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests } } - 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests { 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 @@ internal sealed class GridSplit_Tests 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 @@ internal sealed class GridSplit_Tests 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 7c6fef1c58..782cb987de 100644 --- a/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapGridMap_Tests.cs @@ -21,16 +21,15 @@ internal sealed class MapGridMap_Tests 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 @@ internal sealed class MapGridMap_Tests 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 1ba57f5825..0aea19113e 100644 --- a/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapGrid_Tests.cs @@ -30,12 +30,11 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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 @@ namespace Robust.UnitTesting.Shared.Map 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/MapManager_Tests.cs b/Robust.Shared.IntegrationTests/Map/MapManager_Tests.cs deleted file mode 100644 index 12d4a4604e..0000000000 --- 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/Map/MapPauseTests.cs b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs index 3627df9311..55effd2196 100644 --- a/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs +++ b/Robust.Shared.IntegrationTests/Map/MapPauseTests.cs @@ -26,7 +26,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -47,7 +46,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -68,7 +66,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -89,7 +86,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -108,7 +104,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); // arrange var mapId = sim.CreateMap().Uid; @@ -127,14 +122,14 @@ internal sealed class MapPauseTests { 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); @@ -199,7 +194,6 @@ internal sealed class MapPauseTests { var sim = SimulationFactory(); var entMan = sim.Resolve(); - var mapMan = sim.Resolve(); var mapId = sim.CreateMap().Uid; entMan.System().SetPaused(mapId, true); @@ -219,7 +213,6 @@ internal sealed class MapPauseTests { 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 ed6b1f369e..1686c5ceb5 100644 --- a/Robust.Shared.IntegrationTests/Map/Query_Tests.cs +++ b/Robust.Shared.IntegrationTests/Map/Query_Tests.cs @@ -57,12 +57,11 @@ internal sealed class Query_Tests 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 @@ internal sealed class Query_Tests 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 ada8ffa7d4..6ceda8406f 100644 --- a/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs +++ b/Robust.Shared.IntegrationTests/Map/SingleTileRemoveTest.cs @@ -28,7 +28,6 @@ internal sealed class GridDeleteSingleTileRemoveTestTest : RobustIntegrationTest 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 @@ internal sealed class GridDeleteSingleTileRemoveTestTest : RobustIntegrationTest 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 db24213e23..026d64066a 100644 --- a/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs +++ b/Robust.Shared.IntegrationTests/Physics/BroadphaseNetworkingTest.cs @@ -33,7 +33,6 @@ internal sealed class BroadphaseNetworkingTest : RobustIntegrationTest 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 @@ internal sealed class BroadphaseNetworkingTest : RobustIntegrationTest 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 @@ internal sealed class BroadphaseNetworkingTest : RobustIntegrationTest { // 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 cb87f2dbaa..2f90b231d2 100644 --- a/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/Broadphase_Test.cs @@ -77,12 +77,11 @@ internal sealed class Broadphase_Test { 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 @@ internal sealed class Broadphase_Test { 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 @@ internal sealed class Broadphase_Test { 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 @@ internal sealed class Broadphase_Test { 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 @@ internal sealed class Broadphase_Test { 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 @@ internal sealed class Broadphase_Test 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 a4109827a8..65b824afc7 100644 --- a/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/CollisionWake_Test.cs @@ -41,7 +41,6 @@ namespace Robust.UnitTesting.Shared.Physics await server.WaitIdleAsync(); var entManager = server.ResolveDependency(); - var mapManager = server.ResolveDependency(); var mapSystem = entManager.System(); var transformSystem = entManager.System(); @@ -56,7 +55,7 @@ namespace Robust.UnitTesting.Shared.Physics 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/GridDeletion_Test.cs b/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs index 20b35cdf73..54214964a3 100644 --- a/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/GridDeletion_Test.cs @@ -27,8 +27,8 @@ internal sealed class GridDeletion_Test : RobustIntegrationTest 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 @@ internal sealed class GridDeletion_Test : RobustIntegrationTest 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 @@ internal sealed class GridDeletion_Test : RobustIntegrationTest 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/GridMovement_Test.cs b/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs index 692fad565d..6f6601c895 100644 --- a/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/GridMovement_Test.cs @@ -25,7 +25,6 @@ internal sealed class GridMovement_Test : RobustIntegrationTest // 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 @@ internal sealed class GridMovement_Test : RobustIntegrationTest 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 a8c2d11f2c..7c8bcf9cbd 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 @@ internal sealed class GridReparentVelocity_Test _systems = _sim.Resolve(); _entManager = _sim.Resolve(); - _mapManager = _sim.Resolve(); _fixtureSystem = _systems.GetEntitySystem(); _mapSystem = _systems.GetEntitySystem(); _physSystem = _systems.GetEntitySystem(); @@ -50,7 +48,7 @@ internal sealed class GridReparentVelocity_Test _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 e7ebeb642d..97631aa532 100644 --- a/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/JointDeletion_Test.cs @@ -23,7 +23,6 @@ internal sealed class JointDeletion_Test : RobustIntegrationTest 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/MapVelocity_Test.cs b/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs index 4067f53d13..23434da3b0 100644 --- a/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/MapVelocity_Test.cs @@ -34,8 +34,8 @@ namespace Robust.UnitTesting.Shared.Physics 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 @@ namespace Robust.UnitTesting.Shared.Physics 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 @@ namespace Robust.UnitTesting.Shared.Physics 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 @@ namespace Robust.UnitTesting.Shared.Physics 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/Physics/RayCast_Test.cs b/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs index 1672d94c3e..ee531eb216 100644 --- a/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/RayCast_Test.cs @@ -120,7 +120,7 @@ internal sealed class RayCast_Test 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 4b06137688..10781409e9 100644 --- a/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs +++ b/Robust.Shared.IntegrationTests/Physics/RecursiveUpdateTest.cs @@ -21,13 +21,12 @@ internal sealed class RecursiveUpdateTest { 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 @@ internal sealed class RecursiveUpdateTest { 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 @@ internal sealed class RecursiveUpdateTest 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 eb90f66340..568aeb2825 100644 --- a/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs +++ b/Robust.Shared.IntegrationTests/Physics/Stack_Test.cs @@ -155,7 +155,6 @@ internal sealed class PhysicsTestBedTest : RobustIntegrationTest 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 22fa714730..713ee695ed 100644 --- a/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs +++ b/Robust.Shared.IntegrationTests/Prototypes/HotReloadTest.cs @@ -34,7 +34,6 @@ namespace Robust.UnitTesting.Shared.Prototypes - 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 @@ namespace Robust.UnitTesting.Shared.Prototypes _prototypes.LoadString(InitialPrototypes); _prototypes.ResolveResults(); - _maps = IoCManager.Resolve(); _entities = IoCManager.Resolve(); } diff --git a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs index 3453141b83..91e96400c0 100644 --- a/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs +++ b/Robust.Shared.IntegrationTests/Spawning/EntitySpawnHelpersTest.cs @@ -24,9 +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? - protected IMapManager MapMan = default!; - protected EntityUid Map; protected MapId MapId; protected EntityUid Parent; // entity parented to the map. @@ -44,7 +41,6 @@ public abstract partial class EntitySpawnHelpersTest : RobustIntegrationTest { Server = StartServer(); await Server.WaitIdleAsync(); - MapMan = Server.ResolveDependency(); EntMan = Server.ResolveDependency(); MapSys = EntMan.System(); Xforms = EntMan.System(); diff --git a/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs b/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs index 92401b30d8..eac38f8779 100644 --- a/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs +++ b/Robust.Shared.IntegrationTests/TransformTests/GridTraversalTest.cs @@ -16,7 +16,6 @@ internal sealed class GridTraversalTest : RobustIntegrationTest 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 @@ internal sealed class GridTraversalTest : RobustIntegrationTest 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.Scripting/ScriptGlobalsShared.cs b/Robust.Shared.Scripting/ScriptGlobalsShared.cs index f384b772c0..801df76606 100644 --- a/Robust.Shared.Scripting/ScriptGlobalsShared.cs +++ b/Robust.Shared.Scripting/ScriptGlobalsShared.cs @@ -33,8 +33,6 @@ namespace Robust.Shared.Scripting public IEntitySystemManager esm => _esm; [Dependency] private IPrototypeManager _prot = null!; public IPrototypeManager prot => _prot; - [Dependency] private IMapManager _map = null!; - public IMapManager map => _map; [Dependency] private IDependencyCollection _dependencies = null!; public IDependencyCollection dependencies => _dependencies; [Dependency] private ToolshedManager _shed = null!; diff --git a/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs b/Robust.Shared/ComponentTrees/ComponentTreeSystem.cs index eaae8fab41..5c42e36167 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 @@ public abstract partial class ComponentTreeSystem : EntitySyst 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 1c679f414f..58eb49de4d 100644 --- a/Robust.Shared/Console/Commands/MapCommands.cs +++ b/Robust.Shared/Console/Commands/MapCommands.cs @@ -157,7 +157,6 @@ internal sealed partial class RunMapInitCommand : LocalizedEntityCommands 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 @@ internal sealed partial class ListMapsCommand : LocalizedEntityCommands _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 c028ae2a89..e7e5fd8d44 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 @@ internal sealed partial class TeleportCommand : LocalizedEntityCommands 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/EntitySerialization/MapChunkSerializer.cs b/Robust.Shared/EntitySerialization/MapChunkSerializer.cs index 0b3bb6c1c6..c5df77dfad 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 @@ internal sealed class MapChunkSerializer : ITypeSerializer(); - mapManager.SuppressOnTileChanged = true; + var mapSystem = dependencies.Resolve().System(); + mapSystem.SuppressOnTileChanged = true; ushort size = 16; @@ -112,7 +113,7 @@ internal sealed class MapChunkSerializer : ITypeSerializer(); - 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 @@ internal sealed class MapChunkSerializer : ITypeSerializer _children = new(); - [Dependency] private IMapManager _mapManager = default!; - /// /// Returns the index of the map which this object is on /// @@ -378,7 +376,7 @@ namespace Robust.Shared.GameObjects { _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/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index 2df50e9dbf..dec2756581 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -37,7 +37,6 @@ namespace Robust.Shared.GameObjects [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 @@ namespace Robust.Shared.GameObjects 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 9eee695572..fa7df579f5 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs @@ -94,7 +94,7 @@ public sealed partial class EntityLookupSystem 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); @@ -245,7 +245,7 @@ public sealed partial class EntityLookupSystem 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); @@ -557,7 +557,7 @@ public sealed partial class EntityLookupSystem 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) => @@ -787,7 +787,7 @@ public sealed partial class EntityLookupSystem 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 16d33310d3..f579ecc7bc 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -458,7 +458,7 @@ public sealed partial class EntityLookupSystem // 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 sealed partial class EntityLookupSystem // 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 sealed partial class EntityLookupSystem // 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 1d1e90c671..25e124922f 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/SharedGridTraversalSystem.cs b/Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs index 5cbdd7f6f6..ef0f8f0108 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 sealed partial class SharedGridTraversalSystem : EntitySystem : 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 7ff85746be..de2ad55a9d 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs @@ -25,7 +25,7 @@ public abstract partial class SharedMapSystem // 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.Grid.Queries.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs index ae3165b054..4d754b5903 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.Queries.cs @@ -457,8 +457,7 @@ public abstract partial class SharedMapSystem /// 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, diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs index 94486e8077..9564f3b849 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.cs @@ -22,9 +22,7 @@ namespace Robust.Shared.GameObjects { [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/GameObjects/Systems/SharedTransformSystem.Component.cs b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs index cdeeaf29c8..0e8b2ddcfa 100644 --- a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs +++ b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs @@ -283,7 +283,7 @@ public abstract partial class SharedTransformSystem // 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); } @@ -1016,7 +1016,7 @@ public abstract partial class SharedTransformSystem { 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))); @@ -1259,7 +1259,7 @@ public abstract partial class SharedTransformSystem 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; @@ -1513,7 +1513,7 @@ public abstract partial class SharedTransformSystem 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) @@ -1773,7 +1773,7 @@ public abstract partial class SharedTransformSystem { var mapUid = _map.GetMapOrInvalid(pos2.Value.MapId); - if (!_gridQuery.HasComponent(entity1) && _mapManager.TryFindGridAt(mapUid, pos2.Value.Position, out var targetGrid, out _)) + if (!_gridQuery.HasComponent(entity1) && _map.TryFindGridAt(mapUid, pos2.Value.Position, out var targetGrid, out _)) { var invWorldMatrix = GetInvWorldMatrix(targetGrid); SetCoordinates(entity1, new EntityCoordinates(targetGrid, Vector2.Transform(pos2.Value.Position, invWorldMatrix))); @@ -1796,7 +1796,7 @@ public abstract partial class SharedTransformSystem { var mapUid = _map.GetMapOrInvalid(pos1.Value.MapId); - if (!_gridQuery.HasComponent(entity1) && _mapManager.TryFindGridAt(mapUid, pos1.Value.Position, out var targetGrid, out _)) + if (!_gridQuery.HasComponent(entity1) && _map.TryFindGridAt(mapUid, pos1.Value.Position, out var targetGrid, out _)) { var invWorldMatrix = GetInvWorldMatrix(targetGrid); SetCoordinates(entity2, new EntityCoordinates(targetGrid, Vector2.Transform(pos1.Value.Position, invWorldMatrix))); diff --git a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.cs b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.cs index 3d9b8a545c..730c8f2566 100644 --- a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.cs @@ -19,7 +19,6 @@ namespace Robust.Shared.GameObjects public abstract partial class SharedTransformSystem : EntitySystem { [Dependency] private IGameTiming _gameTiming = default!; - [Dependency] private IMapManager _mapManager = default!; [Dependency] private EntityLookupSystem _lookup = default!; [Dependency] private SharedMapSystem _map = default!; [Dependency] private MetaDataSystem _metaData = default!; diff --git a/Robust.Shared/Map/Components/MapComponent.cs b/Robust.Shared/Map/Components/MapComponent.cs index 3633ad41cb..5fae7461a3 100644 --- a/Robust.Shared/Map/Components/MapComponent.cs +++ b/Robust.Shared/Map/Components/MapComponent.cs @@ -18,10 +18,10 @@ namespace Robust.Shared.Map.Components [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; } diff --git a/Robust.Shared/Map/CoordinatesExtensions.cs b/Robust.Shared/Map/CoordinatesExtensions.cs index 120afdf691..38c8560efa 100644 --- a/Robust.Shared/Map/CoordinatesExtensions.cs +++ b/Robust.Shared/Map/CoordinatesExtensions.cs @@ -8,9 +8,9 @@ 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, ref mapManager); + IoCManager.Resolve(ref entityManager); var xform = entityManager.System(); var gridId = xform.GetGrid(coords); @@ -23,7 +23,7 @@ namespace Robust.Shared.Map var mapCoords = xform.ToMapCoordinates(coords); - if (mapManager.TryFindGridAt(mapCoords, out var gridUid, out mapGrid)) + if (mapSystem.TryFindGridAt(mapCoords, out var gridUid, out mapGrid)) { return mapSystem.GridTileToLocal(gridUid, mapGrid, mapSystem.CoordinatesToTile(gridUid, mapGrid, coords)); } @@ -34,7 +34,7 @@ namespace Robust.Shared.Map // find grids in search box var gridsInArea = new List>(); - mapManager.FindGridsIntersecting(mapCoords.MapId, gridSearchBox, ref gridsInArea); + mapSystem.FindGridsIntersecting(mapCoords.MapId, gridSearchBox, ref gridsInArea); // find closest grid intersecting our search box. gridUid = EntityUid.Invalid; diff --git a/Robust.Shared/Map/EntityCoordinates.cs b/Robust.Shared/Map/EntityCoordinates.cs index 323fe187cb..4eaae6b7ce 100644 --- a/Robust.Shared/Map/EntityCoordinates.cs +++ b/Robust.Shared/Map/EntityCoordinates.cs @@ -95,18 +95,11 @@ namespace Robust.Shared.Map 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. /// public Vector2i ToVector2i( IEntityManager entityManager, - IMapManager mapManager, SharedTransformSystem transformSystem) { if(!IsValid(entityManager)) diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs deleted file mode 100644 index fad26a165a..0000000000 --- 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 c2b19a20f2..0000000000 --- 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 4045791de7..e8848ee8f3 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 7550241825..0000000000 --- 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 3810652f9a..0000000000 --- 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 35415537c4..0000000000 --- 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 8916fa76d8..0000000000 --- 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 3bfd5f3e3c..0000000000 --- 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 fdfbfadf78..0000000000 --- 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.Shared/Physics/Systems/SharedBroadphaseSystem.cs b/Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs index e6fbf61f9b..17d2108ade 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 @@ namespace Robust.Shared.Physics.Systems _contactJob = new() { - MapManager = _mapManager, System = this, TransformSys = EntityManager.System(), + MapSys = _map, // TODO: EntityManager one isn't ready yet? XformQuery = GetEntityQuery(), }; @@ -265,7 +264,7 @@ namespace Robust.Shared.Physics.Systems _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 @@ namespace Robust.Shared.Physics.Systems 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 @@ namespace Robust.Shared.Physics.Systems 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 @@ namespace Robust.Shared.Physics.Systems { public SharedBroadphaseSystem System = default!; public SharedTransformSystem TransformSys = default!; - public IMapManager MapManager = default!; + public SharedMapSystem MapSys = default!; public EntityQuery XformQuery; @@ -626,7 +625,7 @@ namespace Robust.Shared.Physics.Systems 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, diff --git a/Robust.UnitTesting/IIntegrationInstance.cs b/Robust.UnitTesting/IIntegrationInstance.cs index f7c00c1f5c..5585120fb8 100644 --- a/Robust.UnitTesting/IIntegrationInstance.cs +++ b/Robust.UnitTesting/IIntegrationInstance.cs @@ -31,7 +31,6 @@ public interface IIntegrationInstance : IDisposable IConfigurationManager CfgMan { get; } ISharedPlayerManager PlayerMan { get; } INetManager NetMan { get; } - 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 1ada68dcb5..d587ecff17 100644 --- a/Robust.UnitTesting/Pool/TestPair.Helpers.cs +++ b/Robust.UnitTesting/Pool/TestPair.Helpers.cs @@ -281,7 +281,7 @@ public partial class TestPair 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 78aa6842f5..966635c0fe 100644 --- a/Robust.UnitTesting/RobustIntegrationTest.cs +++ b/Robust.UnitTesting/RobustIntegrationTest.cs @@ -406,7 +406,6 @@ namespace Robust.UnitTesting public ISharedPlayerManager PlayerMan { get; private set; } = default!; public INetManager NetMan { get; private set; } = default!; public IGameTiming Timing { get; private set; } = default!; - public IMapManager MapMan { get; private set; } = default!; public IConsoleHost ConsoleHost { get; private set; } = default!; public ISawmill Log { get; private set; } = default!; @@ -418,7 +417,6 @@ namespace Robust.UnitTesting 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 71e63806ac..bdfc90ed64 100644 --- a/Robust.UnitTesting/RobustUnitTest.cs +++ b/Robust.UnitTesting/RobustUnitTest.cs @@ -161,7 +161,6 @@ namespace Robust.UnitTesting } 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 @@ namespace Robust.UnitTesting // 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 @@ namespace Robust.UnitTesting modLoader.TryLoadModulesFrom(ResPath.Root, ""); entMan.Startup(); - mapMan.Startup(); } [OneTimeTearDown]