diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index 5c843ffd83..ee13cadb56 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Content.Client.Shuttles.Systems; using Content.Server.GameTicking; using Content.Server.Maps; using Content.Server.Shuttles.Components; @@ -30,6 +29,12 @@ namespace Content.IntegrationTests.Tests private const bool SkipTestMaps = true; private const string TestMapsPath = "/Maps/Test/"; + private static readonly string[] NoSpawnMaps = + { + "CentComm", + "Dart", + }; + private static string[] Grids = { "/Maps/centcomm.yml", @@ -176,7 +181,7 @@ namespace Content.IntegrationTests.Tests var protoManager = server.ResolveDependency(); var ticker = entManager.EntitySysManager.GetEntitySystem(); var shuttleSystem = entManager.EntitySysManager.GetEntitySystem(); - var stationJobsSystem = entManager.EntitySysManager.GetEntitySystem(); + var xformQuery = entManager.GetEntityQuery(); await server.WaitPost(() => { @@ -195,7 +200,8 @@ namespace Content.IntegrationTests.Tests EntityUid? targetGrid = null; var memberQuery = entManager.GetEntityQuery(); - var grids = mapManager.GetAllMapGrids(mapId); + var grids = mapManager.GetAllMapGrids(mapId).ToList(); + var gridUids = grids.Select(o => o.GridEntityId).ToList(); foreach (var grid in grids) { @@ -221,6 +227,27 @@ namespace Content.IntegrationTests.Tests mapManager.DeleteMap(shuttleMap); + // Test that the map has valid latejoin spawn points + if (!NoSpawnMaps.Contains(mapProto)) + { + var lateSpawns = 0; + + foreach (var comp in entManager.EntityQuery(true)) + { + if (comp.SpawnType != SpawnPointType.LateJoin || + !xformQuery.TryGetComponent(comp.Owner, out var xform) || + xform.GridUid == null || + !gridUids.Contains(xform.GridUid.Value)) + { + continue; + } + + lateSpawns++; + break; + } + + Assert.That(lateSpawns, Is.GreaterThan(0), $"Found no latejoin spawn points on {mapProto}"); + } // Test all availableJobs have spawnPoints // This is done inside gamemap test because loading the map takes ages and we already have it. var jobList = entManager.GetComponent(station).RoundStartJobList