Test to ensure all maps have needed job spawnPoints (#11849)
This commit is contained in:
@@ -8,7 +8,10 @@ using Content.Client.Shuttles.Systems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Roles;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.ContentPack;
|
||||
@@ -127,6 +130,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>();
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
@@ -171,6 +175,23 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
mapManager.DeleteMap(shuttleMap);
|
||||
|
||||
// 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
|
||||
.Where(x => x.Value != 0)
|
||||
.Select(x => x.Key);
|
||||
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
|
||||
.Where(spawnpoint => spawnpoint.SpawnType == SpawnPointType.Job)
|
||||
.Select(spawnpoint => spawnpoint.Job.ID)
|
||||
.Distinct();
|
||||
List<string> missingSpawnPoints = new() { };
|
||||
foreach (var spawnpoint in jobList.Except(spawnPoints))
|
||||
{
|
||||
if (protoManager.Index<JobPrototype>(spawnpoint).SetPreference)
|
||||
missingSpawnPoints.Add(spawnpoint);
|
||||
}
|
||||
Assert.That(missingSpawnPoints.Count() == 0, $"There is no spawnpoint for {String.Join(", ", missingSpawnPoints)} on {mapProto}.");
|
||||
|
||||
try
|
||||
{
|
||||
mapManager.DeleteMap(mapId);
|
||||
|
||||
Reference in New Issue
Block a user