Fix admin test arena (#35444)
* Fix admin test arena * Add to GridsLoadableTest * QueueDel map, remove nullable --------- Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -38,7 +39,8 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private static readonly string[] Grids =
|
||||
{
|
||||
"/Maps/centcomm.yml"
|
||||
"/Maps/centcomm.yml",
|
||||
AdminTestArenaSystem.ArenaMapPath
|
||||
};
|
||||
|
||||
private static readonly string[] DoNotMapWhitelist =
|
||||
|
||||
@@ -12,6 +12,7 @@ public sealed class AdminTestArenaSystem : EntitySystem
|
||||
{
|
||||
[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";
|
||||
|
||||
@@ -33,17 +34,20 @@ public sealed class AdminTestArenaSystem : EntitySystem
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user