Update content to mapsystem (#12387)

This commit is contained in:
metalgearsloth
2022-11-13 17:47:48 +11:00
committed by GitHub
parent 9f5c3318c9
commit 6ab864fcda
16 changed files with 70 additions and 62 deletions

View File

@@ -4,9 +4,11 @@ using System.Linq;
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
using Content.IntegrationTests; using Content.IntegrationTests;
using Content.Server.Maps; using Content.Server.Maps;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared; using Robust.Shared;
using Robust.Shared.Analyzers; using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -37,6 +39,6 @@ public class MapLoadBenchmark
[Benchmark] [Benchmark]
public void LoadMap() public void LoadMap()
{ {
_pair.Pair.Server.ResolveDependency<IMapLoader>().LoadMap(new MapId(10), Paths[Map]); _pair.Pair.Server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>().LoadMap(new MapId(10), Paths[Map]);
} }
} }

View File

@@ -4,6 +4,7 @@ using Content.Server.Body.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
@@ -53,9 +54,9 @@ namespace Content.IntegrationTests.Tests.Body
await server.WaitIdleAsync(); await server.WaitIdleAsync();
var mapLoader = server.ResolveDependency<IMapLoader>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
var mapLoader = entityManager.System<MapLoaderSystem>();
RespiratorSystem respSys = default; RespiratorSystem respSys = default;
MetabolizerSystem metaSys = default; MetabolizerSystem metaSys = default;
@@ -71,7 +72,7 @@ namespace Content.IntegrationTests.Tests.Body
await server.WaitPost(() => await server.WaitPost(() =>
{ {
mapId = mapManager.CreateMap(); mapId = mapManager.CreateMap();
grid = mapLoader.LoadGrid(mapId, testMapName).gridId; grid = mapLoader.LoadGrid(mapId, testMapName);
}); });
Assert.NotNull(grid, $"Test blueprint {testMapName} not found."); Assert.NotNull(grid, $"Test blueprint {testMapName} not found.");
@@ -130,9 +131,9 @@ namespace Content.IntegrationTests.Tests.Body
{NoClient = true, ExtraPrototypes = Prototypes}); {NoClient = true, ExtraPrototypes = Prototypes});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
var mapLoader = entityManager.System<MapLoaderSystem>();
MapId mapId; MapId mapId;
EntityUid? grid = null; EntityUid? grid = null;
@@ -144,7 +145,7 @@ namespace Content.IntegrationTests.Tests.Body
await server.WaitPost(() => await server.WaitPost(() =>
{ {
mapId = mapManager.CreateMap(); mapId = mapManager.CreateMap();
grid = mapLoader.LoadGrid(mapId, testMapName).gridId; grid = mapLoader.LoadGrid(mapId, testMapName);
}); });
Assert.NotNull(grid, $"Test blueprint {testMapName} not found."); Assert.NotNull(grid, $"Test blueprint {testMapName} not found.");

View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Body.Systems; using Content.Shared.Body.Systems;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
@@ -33,7 +34,7 @@ public sealed class SaveLoadReparentTest
var entities = server.ResolveDependency<IEntityManager>(); var entities = server.ResolveDependency<IEntityManager>();
var maps = server.ResolveDependency<IMapManager>(); var maps = server.ResolveDependency<IMapManager>();
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = entities.System<MapLoaderSystem>();
var bodySystem = entities.System<SharedBodySystem>(); var bodySystem = entities.System<SharedBodySystem>();
await server.WaitAssertion(() => await server.WaitAssertion(() =>

View File

@@ -12,6 +12,7 @@ using Content.Server.Station.Components;
using Content.Server.Station.Systems; using Content.Server.Station.Systems;
using Content.Shared.Roles; using Content.Shared.Roles;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -52,7 +53,7 @@ namespace Content.IntegrationTests.Tests
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
await server.WaitPost(() => await server.WaitPost(() =>
@@ -175,9 +176,9 @@ namespace Content.IntegrationTests.Tests
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entManager = server.ResolveDependency<IEntityManager>(); var entManager = server.ResolveDependency<IEntityManager>();
var mapLoader = entManager.System<MapLoaderSystem>();
var protoManager = server.ResolveDependency<IPrototypeManager>(); var protoManager = server.ResolveDependency<IPrototypeManager>();
var ticker = entManager.EntitySysManager.GetEntitySystem<GameTicker>(); var ticker = entManager.EntitySysManager.GetEntitySystem<GameTicker>();
var shuttleSystem = entManager.EntitySysManager.GetEntitySystem<ShuttleSystem>(); var shuttleSystem = entManager.EntitySysManager.GetEntitySystem<ShuttleSystem>();
@@ -223,7 +224,7 @@ namespace Content.IntegrationTests.Tests
var shuttlePath = entManager.GetComponent<StationDataComponent>(station).EmergencyShuttlePath var shuttlePath = entManager.GetComponent<StationDataComponent>(station).EmergencyShuttlePath
.ToString(); .ToString();
var shuttle = mapLoader.LoadGrid(shuttleMap, entManager.GetComponent<StationDataComponent>(station).EmergencyShuttlePath.ToString()); var shuttle = mapLoader.LoadGrid(shuttleMap, entManager.GetComponent<StationDataComponent>(station).EmergencyShuttlePath.ToString());
Assert.That(shuttleSystem.TryFTLDock(entManager.GetComponent<ShuttleComponent>(shuttle.gridId!.Value), targetGrid.Value), $"Unable to dock {shuttlePath} to {mapProto}"); Assert.That(shuttle != null && shuttleSystem.TryFTLDock(entManager.GetComponent<ShuttleComponent>(shuttle.Value), targetGrid.Value), $"Unable to dock {shuttlePath} to {mapProto}");
mapManager.DeleteMap(shuttleMap); mapManager.DeleteMap(shuttleMap);
@@ -331,7 +332,7 @@ namespace Content.IntegrationTests.Tests
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
await server.WaitPost(() => await server.WaitPost(() =>

View File

@@ -1,5 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -20,9 +21,9 @@ namespace Content.IntegrationTests.Tests
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var sEntities = server.ResolveDependency<IEntityManager>(); var sEntities = server.ResolveDependency<IEntityManager>();
var mapLoader = sEntities.System<MapLoaderSystem>();
var resManager = server.ResolveDependency<IResourceManager>(); var resManager = server.ResolveDependency<IResourceManager>();
await server.WaitPost(() => await server.WaitPost(() =>

View File

@@ -2,8 +2,10 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using NUnit.Framework; using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -19,18 +21,20 @@ namespace Content.IntegrationTests.Tests
[Test] [Test]
public async Task SaveLoadSave() 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 server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
await server.WaitPost(() => await server.WaitPost(() =>
{ {
var mapId0 = mapManager.CreateMap();
// TODO: Properly find the "main" station grid. // TODO: Properly find the "main" station grid.
var grid0 = mapManager.GetAllGrids().First(); var grid0 = mapManager.CreateGrid(mapId0);
mapLoader.SaveGrid(grid0.GridEntityId, "save load save 1.yml"); mapLoader.Save(grid0.GridEntityId, "save load save 1.yml");
var mapId = mapManager.CreateMap(); var mapId1 = mapManager.CreateMap();
var grid = mapLoader.LoadGrid(mapId, "save load save 1.yml").gridId; var grid1 = mapLoader.LoadGrid(mapId1, "save load save 1.yml", new MapLoadOptions() {LoadMap = false});
mapLoader.SaveGrid(grid!.Value, "save load save 2.yml"); mapLoader.Save(grid1!.Value, "save load save 2.yml");
}); });
await server.WaitIdleAsync(); await server.WaitIdleAsync();
@@ -40,17 +44,17 @@ namespace Content.IntegrationTests.Tests
string two; string two;
var rp1 = new ResourcePath("/save load save 1.yml"); 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)) using (var reader = new StreamReader(stream))
{ {
one = reader.ReadToEnd(); one = await reader.ReadToEndAsync();
} }
var rp2 = new ResourcePath("/save load save 2.yml"); 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)) using (var reader = new StreamReader(stream))
{ {
two = reader.ReadToEnd(); two = await reader.ReadToEndAsync();
} }
Assert.Multiple(() => { Assert.Multiple(() => {
@@ -82,7 +86,7 @@ namespace Content.IntegrationTests.Tests
{ {
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var mapLoader = server.ResolveDependency<IMapLoader>(); var mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
MapId mapId = default; MapId mapId = default;
@@ -111,16 +115,16 @@ namespace Content.IntegrationTests.Tests
string one; string one;
string two; 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)) 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)) using (var reader = new StreamReader(stream))
{ {
two = reader.ReadToEnd(); two = await reader.ReadToEndAsync();
} }
Assert.Multiple(() => { Assert.Multiple(() => {

View File

@@ -47,8 +47,8 @@ namespace Content.Server.Administration.Commands
{ {
loadOptions.Offset = new Vector2(x, y); loadOptions.Offset = new Vector2(x, y);
} }
var (ents, grids) = gameTicker.LoadGameMap(gameMap, new MapId(mapId), loadOptions, stationName); var grids = gameTicker.LoadGameMap(gameMap, new MapId(mapId), loadOptions, stationName);
shell.WriteLine($"Loaded {ents.Count} entities and {grids.Count} grids."); shell.WriteLine($"Loaded {grids.Count} grids.");
} }
else else
{ {

View File

@@ -1,5 +1,4 @@
using System.Linq; using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Network; using Robust.Shared.Network;
@@ -11,8 +10,8 @@ namespace Content.Server.Administration.Systems;
/// </summary> /// </summary>
public sealed class AdminTestArenaSystem : EntitySystem public sealed class AdminTestArenaSystem : EntitySystem
{ {
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
public const string ArenaMapPath = "/Maps/Test/admin_test_arena.yml"; 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()); ArenaMap[admin.UserId] = _mapManager.GetMapEntityId(_mapManager.CreateMap());
var (_, grids) = _mapLoader.LoadMap(Comp<MapComponent>(ArenaMap[admin.UserId]).WorldMap, ArenaMapPath); var grids = _map.LoadMap(Comp<MapComponent>(ArenaMap[admin.UserId]).WorldMap, ArenaMapPath);
ArenaGrid[admin.UserId] = grids.Count == 0 ? null : grids[0]; ArenaGrid[admin.UserId] = grids.Count == 0 ? null : grids[0];
return (ArenaMap[admin.UserId], ArenaGrid[admin.UserId]); return (ArenaMap[admin.UserId], ArenaGrid[admin.UserId]);

View File

@@ -17,6 +17,7 @@ using Content.Shared.CCVar;
using Content.Shared.Dataset; using Content.Shared.Dataset;
using Content.Shared.GameTicking; using Content.Shared.GameTicking;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
@@ -36,10 +37,10 @@ public sealed partial class CargoSystem
[Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IMapLoader _loader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly PricingSystem _pricing = default!; [Dependency] private readonly PricingSystem _pricing = default!;
[Dependency] private readonly ShuttleConsoleSystem _console = default!; [Dependency] private readonly ShuttleConsoleSystem _console = default!;
@@ -289,7 +290,7 @@ public sealed partial class CargoSystem
var possibleNames = _protoMan.Index<DatasetPrototype>(prototype.NameDataset).Values; var possibleNames = _protoMan.Index<DatasetPrototype>(prototype.NameDataset).Values;
var name = _random.Pick(possibleNames); 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); var xform = Transform(shuttleUid!.Value);
MetaData(shuttleUid!.Value).EntityName = name; MetaData(shuttleUid!.Value).EntityName = name;

View File

@@ -135,7 +135,7 @@ namespace Content.Server.GameTicking
/// <param name="loadOptions">Map loading options, includes offset.</param> /// <param name="loadOptions">Map loading options, includes offset.</param>
/// <param name="stationName">Name to assign to the loaded station.</param> /// <param name="stationName">Name to assign to the loaded station.</param>
/// <returns>All loaded entities and grids.</returns> /// <returns>All loaded entities and grids.</returns>
public (IReadOnlyList<EntityUid> Entities, IReadOnlyList<EntityUid> Grids) LoadGameMap(GameMapPrototype map, MapId targetMapId, MapLoadOptions? loadOptions, string? stationName = null) public IReadOnlyList<EntityUid> 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. // 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. // 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); var ev = new PreGameMapLoad(targetMapId, map, loadOpts);
RaiseLocalEvent(ev); 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(); var gridUids = gridIds.ToList();
RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, entities, gridUids, stationName)); RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, gridUids, stationName));
return (entities, gridUids); return gridUids;
} }
public void StartRound(bool force = false) public void StartRound(bool force = false)
@@ -600,15 +600,13 @@ namespace Content.Server.GameTicking
{ {
public readonly GameMapPrototype GameMap; public readonly GameMapPrototype GameMap;
public readonly MapId Map; public readonly MapId Map;
public readonly IReadOnlyList<EntityUid> Entities;
public readonly IReadOnlyList<EntityUid> Grids; public readonly IReadOnlyList<EntityUid> Grids;
public readonly string? StationName; public readonly string? StationName;
public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList<EntityUid> entities, IReadOnlyList<EntityUid> grids, string? stationName) public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList<EntityUid> grids, string? stationName)
{ {
GameMap = gameMap; GameMap = gameMap;
Map = map; Map = map;
Entities = entities;
Grids = grids; Grids = grids;
StationName = stationName; StationName = stationName;
} }

View File

@@ -15,6 +15,7 @@ using Content.Shared.Damage;
using Content.Shared.GameTicking; using Content.Shared.GameTicking;
using Content.Shared.Roles; using Content.Shared.Roles;
using Robust.Server; using Robust.Server;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Console; using Robust.Shared.Console;
@@ -32,6 +33,8 @@ namespace Content.Server.GameTicking
{ {
public sealed partial class GameTicker : SharedGameTicker public sealed partial class GameTicker : SharedGameTicker
{ {
[Dependency] private readonly MapLoaderSystem _map = default!;
[ViewVariables] private bool _initialized; [ViewVariables] private bool _initialized;
[ViewVariables] private bool _postInitialized; [ViewVariables] private bool _postInitialized;
@@ -95,7 +98,6 @@ namespace Content.Server.GameTicking
} }
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;

View File

@@ -48,7 +48,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
[Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly IServerPreferencesManager _prefs = default!;
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPlayerManager _playerSystem = default!; [Dependency] private readonly IPlayerManager _playerSystem = default!;
[Dependency] private readonly FactionSystem _faction = 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 RoundEndSystem _roundEndSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly RandomHumanoidSystem _randomHumanoid = default!; [Dependency] private readonly RandomHumanoidSystem _randomHumanoid = default!;
@@ -619,7 +619,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
var mapId = _mapManager.CreateMap(); var mapId = _mapManager.CreateMap();
var (_, outpostGrids) = _mapLoader.LoadMap(mapId, path.ToString()); var outpostGrids = _map.LoadMap(mapId, path.ToString());
if (outpostGrids.Count == 0) if (outpostGrids.Count == 0)
{ {
Logger.ErrorS("nukies", $"Error loading map {path} for nukies!"); Logger.ErrorS("nukies", $"Error loading map {path} for nukies!");
@@ -630,7 +630,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
_nukieOutpost = outpostGrids[0]; _nukieOutpost = outpostGrids[0];
// Listen I just don't want it to overlap. // 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, Offset = Vector2.One * 1000f,
}); });

View File

@@ -10,6 +10,7 @@ using Content.Shared.CCVar;
using Content.Shared.Humanoid; using Content.Shared.Humanoid;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Content.Shared.Roles; using Content.Shared.Roles;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
@@ -30,12 +31,12 @@ public sealed class PiratesRuleSystem : GameRuleSystem
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IServerPreferencesManager _prefs = default!; [Dependency] private readonly IServerPreferencesManager _prefs = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!; [Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly PricingSystem _pricingSystem = default!; [Dependency] private readonly PricingSystem _pricingSystem = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly NamingSystem _namingSystem = default!; [Dependency] private readonly NamingSystem _namingSystem = default!;
[ViewVariables] [ViewVariables]
@@ -161,7 +162,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem
aabb.Union(aabbs[i]); 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 Offset = aabb.Center + MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * 2.5f
}); });

View File

@@ -2,6 +2,7 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Console; using Robust.Shared.Console;
@@ -20,9 +21,9 @@ public sealed class MappingSystem : EntitySystem
[Dependency] private readonly IConsoleHost _conHost = default!; [Dependency] private readonly IConsoleHost _conHost = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IResourceManager _resMan = 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 // Not a comp because I don't want to deal with this getting saved onto maps ever
/// <summary> /// <summary>
@@ -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"); var path = Path.Combine(saveDir, $"{DateTime.Now.ToString("yyyy-M-dd_HH.mm.ss")}-AUTO.yml");
_currentlyAutosaving[map] = (CalculateNextTime(), name); _currentlyAutosaving[map] = (CalculateNextTime(), name);
_sawmill.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds."); _sawmill.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds.");
_mapLoader.SaveMap(map, path); _map.SaveMap(map, path);
} }
} }

View File

@@ -1,4 +1,3 @@
using Content.Server.Chat.Managers;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Examine; using Content.Shared.Examine;
@@ -12,24 +11,20 @@ using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Linq; using System.Linq;
using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Server.Ghost.Components; using Content.Server.Ghost.Components;
using Content.Server.Radio.EntitySystems; using Content.Server.Radio.EntitySystems;
using Content.Server.Station.Systems;
using Content.Shared.Chat;
using Content.Shared.Radio; using Content.Shared.Radio;
using Robust.Shared.Network; using Robust.Server.GameObjects;
namespace Content.Server.Salvage namespace Content.Server.Salvage
{ {
public sealed class SalvageSystem : EntitySystem public sealed class SalvageSystem : EntitySystem
{ {
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly RadioSystem _radioSystem = default!; [Dependency] private readonly RadioSystem _radioSystem = default!;
@@ -301,7 +296,7 @@ namespace Content.Server.Salvage
Offset = spawnLocation 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) if (salvageEntityId == null)
{ {
Report(component.Owner, component.SalvageChannel, "salvage-system-announcement-spawn-debris-disintegrated"); Report(component.Owner, component.SalvageChannel, "salvage-system-announcement-spawn-debris-disintegrated");

View File

@@ -11,6 +11,7 @@ using Content.Server.Station.Systems;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Shuttles.Events; using Content.Shared.Shuttles.Events;
using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Audio; using Robust.Shared.Audio;
@@ -32,11 +33,11 @@ public sealed partial class ShuttleSystem
[Dependency] private readonly IAdminLogManager _logger = default!; [Dependency] private readonly IAdminLogManager _logger = default!;
[Dependency] private readonly IAdminManager _admin = default!; [Dependency] private readonly IAdminManager _admin = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IMapLoader _loader = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!; [Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly CommunicationsConsoleSystem _commsConsole = default!; [Dependency] private readonly CommunicationsConsoleSystem _commsConsole = default!;
[Dependency] private readonly DockingSystem _dockSystem = default!; [Dependency] private readonly DockingSystem _dockSystem = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationSystem _station = default!;
public MapId? CentComMap { get; private set; } public MapId? CentComMap { get; private set; }
@@ -405,7 +406,7 @@ public sealed partial class ShuttleSystem
if (!string.IsNullOrEmpty(centComPath)) if (!string.IsNullOrEmpty(centComPath))
{ {
var (_, centcomm) = _loader.LoadGrid(CentComMap.Value, "/Maps/centcomm.yml"); var centcomm = _map.LoadGrid(CentComMap.Value, "/Maps/centcomm.yml");
CentCom = centcomm; CentCom = centcomm;
if (CentCom != null) if (CentCom != null)
@@ -427,7 +428,7 @@ public sealed partial class ShuttleSystem
if (!_emergencyShuttleEnabled || CentComMap == null || component.EmergencyShuttle != null) return; if (!_emergencyShuttleEnabled || CentComMap == null || component.EmergencyShuttle != null) return;
// Load escape shuttle // 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. // Should be far enough... right? I'm too lazy to bounds check CentCom rn.
Offset = new Vector2(500f + _shuttleIndex, 0f) Offset = new Vector2(500f + _shuttleIndex, 0f)