diff --git a/Content.Benchmarks/MapLoadBenchmark.cs b/Content.Benchmarks/MapLoadBenchmark.cs index 40b03e959a..8415dad695 100644 --- a/Content.Benchmarks/MapLoadBenchmark.cs +++ b/Content.Benchmarks/MapLoadBenchmark.cs @@ -4,9 +4,11 @@ using System.Linq; using BenchmarkDotNet.Attributes; using Content.IntegrationTests; using Content.Server.Maps; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared; using Robust.Shared.Analyzers; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; @@ -37,6 +39,6 @@ public class MapLoadBenchmark [Benchmark] public void LoadMap() { - _pair.Pair.Server.ResolveDependency().LoadMap(new MapId(10), Paths[Map]); + _pair.Pair.Server.ResolveDependency().GetEntitySystem().LoadMap(new MapId(10), Paths[Map]); } } diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs index e93ee7af59..8742d105b3 100644 --- a/Content.IntegrationTests/Tests/Body/LungTest.cs +++ b/Content.IntegrationTests/Tests/Body/LungTest.cs @@ -4,6 +4,7 @@ using Content.Server.Body.Components; using Content.Server.Body.Systems; using Content.Shared.Body.Components; using NUnit.Framework; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.GameObjects; using Robust.Shared.Map; @@ -53,9 +54,9 @@ namespace Content.IntegrationTests.Tests.Body await server.WaitIdleAsync(); - var mapLoader = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); + var mapLoader = entityManager.System(); RespiratorSystem respSys = default; MetabolizerSystem metaSys = default; @@ -71,7 +72,7 @@ namespace Content.IntegrationTests.Tests.Body await server.WaitPost(() => { mapId = mapManager.CreateMap(); - grid = mapLoader.LoadGrid(mapId, testMapName).gridId; + grid = mapLoader.LoadGrid(mapId, testMapName); }); Assert.NotNull(grid, $"Test blueprint {testMapName} not found."); @@ -130,9 +131,9 @@ namespace Content.IntegrationTests.Tests.Body {NoClient = true, ExtraPrototypes = Prototypes}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); + var mapLoader = entityManager.System(); MapId mapId; EntityUid? grid = null; @@ -144,7 +145,7 @@ namespace Content.IntegrationTests.Tests.Body await server.WaitPost(() => { mapId = mapManager.CreateMap(); - grid = mapLoader.LoadGrid(mapId, testMapName).gridId; + grid = mapLoader.LoadGrid(mapId, testMapName); }); Assert.NotNull(grid, $"Test blueprint {testMapName} not found."); diff --git a/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs b/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs index 3361864adb..deb2f059c6 100644 --- a/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs +++ b/Content.IntegrationTests/Tests/Body/SaveLoadReparentTest.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Content.Shared.Body.Components; using Content.Shared.Body.Systems; using NUnit.Framework; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.GameObjects; using Robust.Shared.Map; @@ -33,7 +34,7 @@ public sealed class SaveLoadReparentTest var entities = server.ResolveDependency(); var maps = server.ResolveDependency(); - var mapLoader = server.ResolveDependency(); + var mapLoader = entities.System(); var bodySystem = entities.System(); await server.WaitAssertion(() => diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index ee13cadb56..b819154a41 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -12,6 +12,7 @@ using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.Roles; using NUnit.Framework; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; @@ -52,7 +53,7 @@ namespace Content.IntegrationTests.Tests await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); + var mapLoader = server.ResolveDependency().GetEntitySystem(); var mapManager = server.ResolveDependency(); await server.WaitPost(() => @@ -175,9 +176,9 @@ namespace Content.IntegrationTests.Tests await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var entManager = server.ResolveDependency(); + var mapLoader = entManager.System(); var protoManager = server.ResolveDependency(); var ticker = entManager.EntitySysManager.GetEntitySystem(); var shuttleSystem = entManager.EntitySysManager.GetEntitySystem(); @@ -223,7 +224,7 @@ namespace Content.IntegrationTests.Tests var shuttlePath = entManager.GetComponent(station).EmergencyShuttlePath .ToString(); var shuttle = mapLoader.LoadGrid(shuttleMap, entManager.GetComponent(station).EmergencyShuttlePath.ToString()); - Assert.That(shuttleSystem.TryFTLDock(entManager.GetComponent(shuttle.gridId!.Value), targetGrid.Value), $"Unable to dock {shuttlePath} to {mapProto}"); + Assert.That(shuttle != null && shuttleSystem.TryFTLDock(entManager.GetComponent(shuttle.Value), targetGrid.Value), $"Unable to dock {shuttlePath} to {mapProto}"); mapManager.DeleteMap(shuttleMap); @@ -331,7 +332,7 @@ namespace Content.IntegrationTests.Tests await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); + var mapLoader = server.ResolveDependency().GetEntitySystem(); var mapManager = server.ResolveDependency(); await server.WaitPost(() => diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs index 8244c2299a..aebdf7a037 100644 --- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using NUnit.Framework; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; @@ -20,9 +21,9 @@ namespace Content.IntegrationTests.Tests await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var sEntities = server.ResolveDependency(); + var mapLoader = sEntities.System(); var resManager = server.ResolveDependency(); await server.WaitPost(() => diff --git a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs index 2a42f36047..92048b15c8 100644 --- a/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadSaveTest.cs @@ -2,8 +2,10 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.ContentPack; +using Robust.Shared.GameObjects; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Utility; @@ -19,18 +21,20 @@ namespace Content.IntegrationTests.Tests [Test] public async Task SaveLoadSave() { - await using var pairTracker = await PoolManager.GetServerClient(new (){Fresh = true, Disconnected = true}); + await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings {Fresh = true, Disconnected = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); + var mapLoader = server.ResolveDependency().GetEntitySystem(); var mapManager = server.ResolveDependency(); + await server.WaitPost(() => { + var mapId0 = mapManager.CreateMap(); // TODO: Properly find the "main" station grid. - var grid0 = mapManager.GetAllGrids().First(); - mapLoader.SaveGrid(grid0.GridEntityId, "save load save 1.yml"); - var mapId = mapManager.CreateMap(); - var grid = mapLoader.LoadGrid(mapId, "save load save 1.yml").gridId; - mapLoader.SaveGrid(grid!.Value, "save load save 2.yml"); + var grid0 = mapManager.CreateGrid(mapId0); + mapLoader.Save(grid0.GridEntityId, "save load save 1.yml"); + var mapId1 = mapManager.CreateMap(); + var grid1 = mapLoader.LoadGrid(mapId1, "save load save 1.yml", new MapLoadOptions() {LoadMap = false}); + mapLoader.Save(grid1!.Value, "save load save 2.yml"); }); await server.WaitIdleAsync(); @@ -40,17 +44,17 @@ namespace Content.IntegrationTests.Tests string two; var rp1 = new ResourcePath("/save load save 1.yml"); - using (var stream = userData.Open(rp1, FileMode.Open)) + await using (var stream = userData.Open(rp1, FileMode.Open)) using (var reader = new StreamReader(stream)) { - one = reader.ReadToEnd(); + one = await reader.ReadToEndAsync(); } var rp2 = new ResourcePath("/save load save 2.yml"); - using (var stream = userData.Open(rp2, FileMode.Open)) + await using (var stream = userData.Open(rp2, FileMode.Open)) using (var reader = new StreamReader(stream)) { - two = reader.ReadToEnd(); + two = await reader.ReadToEndAsync(); } Assert.Multiple(() => { @@ -82,7 +86,7 @@ namespace Content.IntegrationTests.Tests { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; - var mapLoader = server.ResolveDependency(); + var mapLoader = server.ResolveDependency().GetEntitySystem(); var mapManager = server.ResolveDependency(); MapId mapId = default; @@ -111,16 +115,16 @@ namespace Content.IntegrationTests.Tests string one; string two; - using (var stream = userData.Open(new ResourcePath("/load save ticks save 1.yml"), FileMode.Open)) + await using (var stream = userData.Open(new ResourcePath("/load save ticks save 1.yml"), FileMode.Open)) using (var reader = new StreamReader(stream)) { - one = reader.ReadToEnd(); + one = await reader.ReadToEndAsync(); } - using (var stream = userData.Open(new ResourcePath("/load save ticks save 2.yml"), FileMode.Open)) + await using (var stream = userData.Open(new ResourcePath("/load save ticks save 2.yml"), FileMode.Open)) using (var reader = new StreamReader(stream)) { - two = reader.ReadToEnd(); + two = await reader.ReadToEndAsync(); } Assert.Multiple(() => { diff --git a/Content.Server/Administration/Commands/LoadGameMapCommand.cs b/Content.Server/Administration/Commands/LoadGameMapCommand.cs index 5f8e82796d..ead73abb14 100644 --- a/Content.Server/Administration/Commands/LoadGameMapCommand.cs +++ b/Content.Server/Administration/Commands/LoadGameMapCommand.cs @@ -47,8 +47,8 @@ namespace Content.Server.Administration.Commands { loadOptions.Offset = new Vector2(x, y); } - var (ents, grids) = gameTicker.LoadGameMap(gameMap, new MapId(mapId), loadOptions, stationName); - shell.WriteLine($"Loaded {ents.Count} entities and {grids.Count} grids."); + var grids = gameTicker.LoadGameMap(gameMap, new MapId(mapId), loadOptions, stationName); + shell.WriteLine($"Loaded {grids.Count} grids."); } else { diff --git a/Content.Server/Administration/Systems/AdminTestArenaSystem.cs b/Content.Server/Administration/Systems/AdminTestArenaSystem.cs index 3eeeabc40a..5640c580fb 100644 --- a/Content.Server/Administration/Systems/AdminTestArenaSystem.cs +++ b/Content.Server/Administration/Systems/AdminTestArenaSystem.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Robust.Server.Maps; +using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Map; using Robust.Shared.Network; @@ -11,8 +10,8 @@ namespace Content.Server.Administration.Systems; /// public sealed class AdminTestArenaSystem : EntitySystem { - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; public const string ArenaMapPath = "/Maps/Test/admin_test_arena.yml"; @@ -35,7 +34,7 @@ public sealed class AdminTestArenaSystem : EntitySystem } ArenaMap[admin.UserId] = _mapManager.GetMapEntityId(_mapManager.CreateMap()); - var (_, grids) = _mapLoader.LoadMap(Comp(ArenaMap[admin.UserId]).WorldMap, ArenaMapPath); + var grids = _map.LoadMap(Comp(ArenaMap[admin.UserId]).WorldMap, ArenaMapPath); ArenaGrid[admin.UserId] = grids.Count == 0 ? null : grids[0]; return (ArenaMap[admin.UserId], ArenaGrid[admin.UserId]); diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index 7aceb2aaa2..2c80b1d1e0 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -17,6 +17,7 @@ using Content.Shared.CCVar; using Content.Shared.Dataset; using Content.Shared.GameTicking; using Content.Shared.MobState.Components; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.Audio; using Robust.Shared.Configuration; @@ -36,10 +37,10 @@ public sealed partial class CargoSystem [Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IGameTiming _timing = default!; - [Dependency] private readonly IMapLoader _loader = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly PricingSystem _pricing = default!; [Dependency] private readonly ShuttleConsoleSystem _console = default!; @@ -289,7 +290,7 @@ public sealed partial class CargoSystem var possibleNames = _protoMan.Index(prototype.NameDataset).Values; var name = _random.Pick(possibleNames); - var (_, shuttleUid) = _loader.LoadGrid(CargoMap.Value, prototype.Path.ToString()); + var shuttleUid = _map.LoadGrid(CargoMap.Value, prototype.Path.ToString()); var xform = Transform(shuttleUid!.Value); MetaData(shuttleUid!.Value).EntityName = name; diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 3c6ef158ec..95e7e3ebd4 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -135,7 +135,7 @@ namespace Content.Server.GameTicking /// Map loading options, includes offset. /// Name to assign to the loaded station. /// All loaded entities and grids. - public (IReadOnlyList Entities, IReadOnlyList Grids) LoadGameMap(GameMapPrototype map, MapId targetMapId, MapLoadOptions? loadOptions, string? stationName = null) + public IReadOnlyList LoadGameMap(GameMapPrototype map, MapId targetMapId, MapLoadOptions? loadOptions, string? stationName = null) { // Okay I specifically didn't set LoadMap here because this is typically called onto a new map. // whereas the command can also be used on an existing map. @@ -144,12 +144,12 @@ namespace Content.Server.GameTicking var ev = new PreGameMapLoad(targetMapId, map, loadOpts); RaiseLocalEvent(ev); - var (entities, gridIds) = _mapLoader.LoadMap(targetMapId, ev.GameMap.MapPath.ToString(), ev.Options); + var gridIds = _map.LoadMap(targetMapId, ev.GameMap.MapPath.ToString(), ev.Options); - var gridUids = gridIds.Select(g => g).ToList(); - RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, entities, gridUids, stationName)); + var gridUids = gridIds.ToList(); + RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, gridUids, stationName)); - return (entities, gridUids); + return gridUids; } public void StartRound(bool force = false) @@ -600,15 +600,13 @@ namespace Content.Server.GameTicking { public readonly GameMapPrototype GameMap; public readonly MapId Map; - public readonly IReadOnlyList Entities; public readonly IReadOnlyList Grids; public readonly string? StationName; - public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList entities, IReadOnlyList grids, string? stationName) + public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList grids, string? stationName) { GameMap = gameMap; Map = map; - Entities = entities; Grids = grids; StationName = stationName; } diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 861a10e98c..ec21e456ef 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -15,6 +15,7 @@ using Content.Shared.Damage; using Content.Shared.GameTicking; using Content.Shared.Roles; using Robust.Server; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.Configuration; using Robust.Shared.Console; @@ -32,6 +33,8 @@ namespace Content.Server.GameTicking { public sealed partial class GameTicker : SharedGameTicker { + [Dependency] private readonly MapLoaderSystem _map = default!; + [ViewVariables] private bool _initialized; [ViewVariables] private bool _postInitialized; @@ -95,7 +98,6 @@ namespace Content.Server.GameTicking } [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IChatManager _chatManager = default!; diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index cc74cd1b0d..0854542cc9 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -48,7 +48,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPlayerManager _playerSystem = default!; [Dependency] private readonly FactionSystem _faction = default!; @@ -58,6 +57,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem [Dependency] private readonly RoundEndSystem _roundEndSystem = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly GameTicker _ticker = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; [Dependency] private readonly RandomHumanoidSystem _randomHumanoid = default!; @@ -619,7 +619,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem var mapId = _mapManager.CreateMap(); - var (_, outpostGrids) = _mapLoader.LoadMap(mapId, path.ToString()); + var outpostGrids = _map.LoadMap(mapId, path.ToString()); if (outpostGrids.Count == 0) { Logger.ErrorS("nukies", $"Error loading map {path} for nukies!"); @@ -630,7 +630,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem _nukieOutpost = outpostGrids[0]; // Listen I just don't want it to overlap. - var (_, shuttleId) = _mapLoader.LoadGrid(mapId, shuttlePath.ToString(), new MapLoadOptions() + var shuttleId = _map.LoadGrid(mapId, shuttlePath.ToString(), new MapLoadOptions() { Offset = Vector2.One * 1000f, }); diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index 08829de159..35e0bf7551 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.CCVar; using Content.Shared.Humanoid; using Content.Shared.Preferences; using Content.Shared.Roles; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Server.Player; using Robust.Shared.Configuration; @@ -30,12 +31,12 @@ public sealed class PiratesRuleSystem : GameRuleSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly PricingSystem _pricingSystem = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; [Dependency] private readonly NamingSystem _namingSystem = default!; [ViewVariables] @@ -161,7 +162,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem aabb.Union(aabbs[i]); } - var (_, gridId) = _mapLoader.LoadGrid(GameTicker.DefaultMap, map, new MapLoadOptions + var gridId = _map.LoadGrid(GameTicker.DefaultMap, map, new MapLoadOptions { Offset = aabb.Center + MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * 2.5f }); diff --git a/Content.Server/Mapping/MappingSystem.cs b/Content.Server/Mapping/MappingSystem.cs index 69ee9711a2..423f14717c 100644 --- a/Content.Server/Mapping/MappingSystem.cs +++ b/Content.Server/Mapping/MappingSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Administration; using Content.Shared.Administration; using Content.Shared.CCVar; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.Configuration; using Robust.Shared.Console; @@ -20,9 +21,9 @@ public sealed class MappingSystem : EntitySystem [Dependency] private readonly IConsoleHost _conHost = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IResourceManager _resMan = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; // Not a comp because I don't want to deal with this getting saved onto maps ever /// @@ -86,7 +87,7 @@ public sealed class MappingSystem : EntitySystem var path = Path.Combine(saveDir, $"{DateTime.Now.ToString("yyyy-M-dd_HH.mm.ss")}-AUTO.yml"); _currentlyAutosaving[map] = (CalculateNextTime(), name); _sawmill.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds."); - _mapLoader.SaveMap(map, path); + _map.SaveMap(map, path); } } diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 54b2eb693f..ebbd4651a9 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -1,4 +1,3 @@ -using Content.Server.Chat.Managers; using Content.Server.GameTicking; using Content.Shared.CCVar; using Content.Shared.Examine; @@ -12,24 +11,20 @@ using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Utility; using System.Linq; -using Content.Server.Chat; -using Content.Server.Chat.Systems; using Content.Server.Ghost.Components; using Content.Server.Radio.EntitySystems; -using Content.Server.Station.Systems; -using Content.Shared.Chat; using Content.Shared.Radio; -using Robust.Shared.Network; +using Robust.Server.GameObjects; namespace Content.Server.Salvage { public sealed class SalvageSystem : EntitySystem { - [Dependency] private readonly IMapLoader _mapLoader = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly RadioSystem _radioSystem = default!; @@ -301,7 +296,7 @@ namespace Content.Server.Salvage Offset = spawnLocation }; - var (_, salvageEntityId) = _mapLoader.LoadGrid(spl.MapId, map.MapPath.ToString(), opts); + var salvageEntityId = _map.LoadGrid(spl.MapId, map.MapPath.ToString(), opts); if (salvageEntityId == null) { Report(component.Owner, component.SalvageChannel, "salvage-system-announcement-spawn-debris-disintegrated"); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs index 9f2b945676..da7c5a6b29 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs @@ -11,6 +11,7 @@ using Content.Server.Station.Systems; using Content.Shared.CCVar; using Content.Shared.Database; using Content.Shared.Shuttles.Events; +using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Server.Player; using Robust.Shared.Audio; @@ -32,11 +33,11 @@ public sealed partial class ShuttleSystem [Dependency] private readonly IAdminLogManager _logger = default!; [Dependency] private readonly IAdminManager _admin = default!; [Dependency] private readonly IConfigurationManager _configManager = default!; - [Dependency] private readonly IMapLoader _loader = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ChatSystem _chatSystem = default!; [Dependency] private readonly CommunicationsConsoleSystem _commsConsole = default!; [Dependency] private readonly DockingSystem _dockSystem = default!; + [Dependency] private readonly MapLoaderSystem _map = default!; [Dependency] private readonly StationSystem _station = default!; public MapId? CentComMap { get; private set; } @@ -405,7 +406,7 @@ public sealed partial class ShuttleSystem if (!string.IsNullOrEmpty(centComPath)) { - var (_, centcomm) = _loader.LoadGrid(CentComMap.Value, "/Maps/centcomm.yml"); + var centcomm = _map.LoadGrid(CentComMap.Value, "/Maps/centcomm.yml"); CentCom = centcomm; if (CentCom != null) @@ -427,7 +428,7 @@ public sealed partial class ShuttleSystem if (!_emergencyShuttleEnabled || CentComMap == null || component.EmergencyShuttle != null) return; // Load escape shuttle - var (_, shuttle) = _loader.LoadGrid(CentComMap.Value, component.EmergencyShuttlePath.ToString(), new MapLoadOptions() + var shuttle = _map.LoadGrid(CentComMap.Value, component.EmergencyShuttlePath.ToString(), new MapLoadOptions() { // Should be far enough... right? I'm too lazy to bounds check CentCom rn. Offset = new Vector2(500f + _shuttleIndex, 0f)