diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index cc2b16ea1a..b2631d49f2 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -40,7 +40,6 @@ public sealed class PostMapInitTest private static readonly string[] Grids = { - "/Maps/CentralCommand/main.yml", /// "/Maps/CentralCommand/harmony.yml", // Harmony CC version, WWDP edit, no more CentCom rotation AdminTestArenaSystem.ArenaMapPath, }; diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 15bc26f5ea..3d566fa0d5 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -550,41 +550,55 @@ private void AddSingleCentcomm(EntityUid station, StationCentcommComponent compo return; } - var map = _mapSystem.CreateMap(out var mapId); - if (!_loader.TryLoadGrid(mapId, mapPath, out var grid)) + if (!_loader.TryLoadMap(mapPath, out var map, out var grids)) { - Log.Error($"Failed to set up centcomm grid!"); + Log.Error($"Failed to set up centcomm map from {mapPath}!"); + return; + } + + if (map is null || grids is null || grids.Count == 0) + { + Log.Error($"Centcomm map {mapPath} did not contain any grids."); + if (map != null) + QueueDel(map.Value.Owner); return; } - if (!Exists(map)) + if (grids.Count > 1) + { + Log.Warning($"Centcomm map {mapPath} contained multiple grids; using the first one."); + } + + var grid = grids.First(); + if (!Exists(map.Value.Owner)) { Log.Error($"Failed to set up centcomm map!"); - QueueDel(grid); return; } - if (!Exists(grid)) + if (!Exists(grid.Owner)) { Log.Error($"Failed to set up centcomm grid!"); - QueueDel(map); + QueueDel(map.Value.Owner); return; } - var xform = Transform(grid.Value); - if (xform.ParentUid != map || xform.MapUid != map) + var xform = Transform(grid.Owner); + if (xform.ParentUid != map.Value.Owner || xform.MapUid != map.Value.Owner) { Log.Error($"Centcomm grid is not parented to its own map?"); - QueueDel(map); - QueueDel(grid); + QueueDel(map.Value.Owner); + QueueDel(grid.Owner); return; } - component.MapEntity = map; - _metaData.SetEntityName(map, Loc.GetString("map-name-centcomm")); - component.Entity = grid; - _shuttle.TryAddFTLDestination(mapId, true, out _); - Log.Info($"Created centcomm grid {ToPrettyString(grid)} on map {ToPrettyString(map)} for station {ToPrettyString(station)}"); + _mapSystem.InitializeMap(map.Value.Comp.MapId); + + component.MapEntity = map.Value.Owner; + _metaData.SetEntityName(map.Value.Owner, Loc.GetString("map-name-centcomm")); + component.Entity = grid.Owner; + _shuttle.TryAddFTLDestination(map.Value.Comp.MapId, true, out _); + Log.Info($"Created centcomm grid {ToPrettyString(grid)} on map {ToPrettyString(map.Value.Owner)} for station {ToPrettyString(station)}"); } public HashSet GetCentcommMaps() diff --git a/Resources/Maps/CentralCommand/main.yml b/Resources/Maps/CentralCommand/main.yml index 27bf0e26e5..c0f5ca4040 100644 --- a/Resources/Maps/CentralCommand/main.yml +++ b/Resources/Maps/CentralCommand/main.yml @@ -1,16 +1,16 @@ meta: format: 7 - category: Grid + category: Map engineVersion: 260.2.0 forkId: "" forkVersion: "" time: 08/02/2025 19:00:26 - entityCount: 6947 -maps: [] + entityCount: 6948 +maps: +- 8000 grids: - 1668 -orphans: -- 1668 +orphans: [] nullspace: [] tilemap: 0: Space @@ -34,12 +34,25 @@ tilemap: entities: - proto: "" entities: + - uid: 8000 + components: + - type: MetaData + name: Central Command Map + - type: Transform + - type: Map + mapPaused: True + - type: PhysicsMap + - type: GridTree + - type: MovedGrids + - type: Broadphase + - type: OccluderTree + - type: LoadedMap - uid: 1668 components: - type: MetaData name: Central Command - type: Transform - parent: invalid + parent: 8000 - type: MapGrid chunks: -1,-1: diff --git a/Resources/Prototypes/Maps/CentralCommand/main.yml b/Resources/Prototypes/Maps/CentralCommand/main.yml index 8938d48000..f41d069837 100644 --- a/Resources/Prototypes/Maps/CentralCommand/main.yml +++ b/Resources/Prototypes/Maps/CentralCommand/main.yml @@ -1,6 +1,5 @@ - type: gameMap id: CentCommMain - isGrid: true # Did you know that centcomm is the only "game map" that isn't actually a map? Send help. mapName: 'Central Command' mapPath: /Maps/CentralCommand/main.yml minPlayers: 0