From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 24 Feb 2025 06:05:59 +0000 (+1100) Subject: Fix admin test arena (#35444) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=5385683b7e74e90570402ed6db41e67ee5ebc042;p=space-station-14.git Fix admin test arena (#35444) * Fix admin test arena * Add to GridsLoadableTest * QueueDel map, remove nullable --------- Co-authored-by: ElectroJr --- diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index 65eac0a698..177161d587 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -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 = diff --git a/Content.Server/Administration/Systems/AdminTestArenaSystem.cs b/Content.Server/Administration/Systems/AdminTestArenaSystem.cs index 12bf0eba64..f45af60f6d 100644 --- a/Content.Server/Administration/Systems/AdminTestArenaSystem.cs +++ b/Content.Server/Administration/Systems/AdminTestArenaSystem.cs @@ -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); } }