Fixed lab critters not obeying spawn limits

This commit is contained in:
Dominic authored and Cameron Ewell committed 2021-10-22 22:22:56 -04:00
1 parent 6ab8aa4a6f
commit d24604cbdc
1 file changed
+5
+5
View File
@@ -3975,6 +3975,11 @@ namespace CalamityMod.NPCs
int spawnRate = 400;
int maxSpawnCount = (int)MaxSpawnsField.GetValue(null);
NPCLoader.EditSpawnRate(player, ref spawnRate, ref maxSpawnCount);
// Enforce a limit on the amount of enemies that can appear.
if (player.activeNPCs >= maxSpawnCount)
return;
for (int i = 0; i < 18; i++)
{
int checkPositionX = (int)(player.Center.X / 16 + Main.rand.Next(30, 54) * Main.rand.NextBool(2).ToDirectionInt());