Skip to content

Commit

Permalink
?
Browse files Browse the repository at this point in the history
  • Loading branch information
CrimeMoot authored Aug 20, 2024
1 parent 8e136d9 commit efefeef
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,43 @@ await server.WaitPost(() =>
lateSpawns += GetCountLateSpawn<SpawnPointComponent>(gridUids, entManager);
lateSpawns += GetCountLateSpawn<ContainerSpawnPointComponent>(gridUids, entManager);
//start - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
// Output the number of latejoin spawn points found
Console.WriteLine($"Late spawn points found on {mapProto}: {lateSpawns}");
//end - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
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.
// Test all available jobs have spawn points
// This is done inside the gamemap test because loading the map takes ages and we already have it.
var comp = entManager.GetComponent<StationJobsComponent>(station);
var jobs = new HashSet<ProtoId<JobPrototype>>(comp.SetupAvailableJobs.Keys);
//start - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
// Output the available jobs and their count
Console.WriteLine($"Available jobs on {mapProto}: {string.Join(", ", jobs)} (Total: {jobs.Count})");
//end - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
.Where(x => x.SpawnType == SpawnPointType.Job)
//start - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
.Where(x => x.SpawnType == SpawnPointType.Job && x.Job.HasValue)
.Select(x => x.Job!.Value);
// Output the jobs that have spawn points
Console.WriteLine($"Jobs with spawn points on {mapProto}: {string.Join(", ", spawnPoints)}");
jobs.ExceptWith(spawnPoints);
Assert.That(jobs, Is.Empty, $"There is no spawnpoints for {string.Join(", ", jobs)} on {mapProto}.");
// If there are jobs without spawn points, output them
if (jobs.Count > 0)
{
Console.WriteLine($"Jobs without spawn points on {mapProto}: {string.Join(", ", jobs)}");
}
Assert.That(jobs, Is.Empty, $"There are no spawn points for {string.Join(", ", jobs)} on {mapProto}.");
//end - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
}
try
Expand All @@ -304,11 +326,18 @@ private static int GetCountLateSpawn<T>(List<EntityUid> gridUids, IEntityManager
#nullable enable
while (queryPoint.MoveNext(out T? comp, out var xform))
{
var spawner = (ISpawnPoint) comp;
//start - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed
// Check for null for both spawner and transform components
if (comp == null || xform == null)
continue;

var spawner = (ISpawnPoint)comp;
//stop - Exodus //2 0.08.2024-fix-poinstmaps-and-brigmed

// Validate the spawner and its type
if (spawner.SpawnType is not SpawnPointType.LateJoin
|| xform.GridUid == null
|| !gridUids.Contains(xform.GridUid.Value))
|| xform.GridUid == null
|| !gridUids.Contains(xform.GridUid.Value))
{
continue;
}
Expand Down

0 comments on commit efefeef

Please sign in to comment.