using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Content.Server.Administration.Systems;
using Content.Server.GameTicking;
using Content.Server.Maps;
using Content.Server.Shuttles.Components;
private static readonly string[] Grids =
{
- "/Maps/centcomm.yml"
+ "/Maps/centcomm.yml",
+ AdminTestArenaSystem.ArenaMapPath
};
private static readonly string[] DoNotMapWhitelist =
{
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
+ [Dependency] private readonly SharedMapSystem _maps = default!;
public const string ArenaMapPath = "/Maps/Test/admin_test_arena.yml";
}
var path = new ResPath(ArenaMapPath);
- if (!_loader.TryLoadMap(path, out var map, out var grids))
+ var mapUid = _maps.CreateMap(out var mapId);
+
+ if (!_loader.TryLoadGrid(mapId, path, out var grid))
+ {
+ QueueDel(mapUid);
throw new Exception($"Failed to load admin arena");
+ }
- ArenaMap[admin.UserId] = map.Value.Owner;
- _metaDataSystem.SetEntityName(map.Value.Owner, $"ATAM-{admin.Name}");
+ ArenaMap[admin.UserId] = mapUid;
+ _metaDataSystem.SetEntityName(mapUid, $"ATAM-{admin.Name}");
- var grid = grids.FirstOrNull();
- ArenaGrid[admin.UserId] = grid?.Owner;
- if (grid != null)
- _metaDataSystem.SetEntityName(grid.Value.Owner, $"ATAG-{admin.Name}");
+ ArenaGrid[admin.UserId] = grid.Value.Owner;
+ _metaDataSystem.SetEntityName(grid.Value.Owner, $"ATAG-{admin.Name}");
- return (map.Value.Owner, grid?.Owner);
+ return (mapUid, grid.Value.Owner);
}
}