Add test for latejoin spawns (#11473)
* Add test for latejoin spawns * Fix the test Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
@@ -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<IPrototypeManager>();
|
||||
var ticker = entManager.EntitySysManager.GetEntitySystem<GameTicker>();
|
||||
var shuttleSystem = entManager.EntitySysManager.GetEntitySystem<ShuttleSystem>();
|
||||
var stationJobsSystem = entManager.EntitySysManager.GetEntitySystem<StationJobsSystem>();
|
||||
var xformQuery = entManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
@@ -195,7 +200,8 @@ namespace Content.IntegrationTests.Tests
|
||||
EntityUid? targetGrid = null;
|
||||
var memberQuery = entManager.GetEntityQuery<StationMemberComponent>();
|
||||
|
||||
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<SpawnPointComponent>(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<StationJobsComponent>(station).RoundStartJobList
|
||||
|
||||
Reference in New Issue
Block a user