using Content.IntegrationTests;
using Content.IntegrationTests.Pair;
using Content.Server.Maps;
-using Robust.Server.GameObjects;
using Robust.Shared;
using Robust.Shared.Analyzers;
+using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
+using Robust.Shared.Utility;
namespace Content.Benchmarks;
{
private TestPair _pair = default!;
private MapLoaderSystem _mapLoader = default!;
- private IMapManager _mapManager = default!;
+ private SharedMapSystem _mapSys = default!;
[GlobalSetup]
public void Setup()
.ToDictionary(x => x.ID, x => x.MapPath.ToString());
_mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
- _mapManager = server.ResolveDependency<IMapManager>();
+ _mapSys = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<SharedMapSystem>();
}
[GlobalCleanup]
public string Map;
public Dictionary<string, string> Paths;
+ private MapId _mapId;
[Benchmark]
public async Task LoadMap()
{
- var mapPath = Paths[Map];
+ var mapPath = new ResPath(Paths[Map]);
var server = _pair.Server;
await server.WaitPost(() =>
{
- var success = _mapLoader.TryLoad(new MapId(10), mapPath, out _);
+ var success = _mapLoader.TryLoadMap(mapPath, out var map, out _);
if (!success)
throw new Exception("Map load failed");
+ _mapId = map.Value.Comp.MapId;
});
}
public void IterationCleanup()
{
var server = _pair.Server;
- server.WaitPost(() =>
- {
- _mapManager.DeleteMap(new MapId(10));
- }).Wait();
+ server.WaitPost(() => _mapSys.DeleteMap(_mapId))
+ .Wait();
}
}