Add new entity spawn test & fix misc bugs (#19953)
This commit is contained in:
@@ -78,12 +78,12 @@ public static class EntitySpawnCollection
|
||||
/// <param name="entries">The entity spawn entries.</param>
|
||||
/// <param name="random">Resolve param.</param>
|
||||
/// <returns>A list of entity prototypes that should be spawned.</returns>
|
||||
public static List<string?> GetSpawns(IEnumerable<EntitySpawnEntry> entries,
|
||||
public static List<string> GetSpawns(IEnumerable<EntitySpawnEntry> entries,
|
||||
IRobustRandom? random = null)
|
||||
{
|
||||
IoCManager.Resolve(ref random);
|
||||
|
||||
var spawned = new List<string?>();
|
||||
var spawned = new List<string>();
|
||||
var ungrouped = CollectOrGroups(entries, out var orGroupedSpawns);
|
||||
|
||||
foreach (var entry in ungrouped)
|
||||
@@ -93,6 +93,9 @@ public static class EntitySpawnCollection
|
||||
if (entry.SpawnProbability != 1f && !random.Prob(entry.SpawnProbability))
|
||||
continue;
|
||||
|
||||
if (entry.PrototypeId == null)
|
||||
continue;
|
||||
|
||||
var amount = (int) entry.GetAmount(random);
|
||||
|
||||
for (var i = 0; i < amount; i++)
|
||||
@@ -116,6 +119,9 @@ public static class EntitySpawnCollection
|
||||
if (diceRoll > cumulative)
|
||||
continue;
|
||||
|
||||
if (entry.PrototypeId == null)
|
||||
break;
|
||||
|
||||
// Dice roll succeeded, add item and break loop
|
||||
var amount = (int) entry.GetAmount(random);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user