Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetAvailableAmountOfNPCsToSpawnUpToSlot()

static int Terraria.NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot ( int amountWeWant,
int highestNPCSlotIndexWeWillPick = 100 )
inlinestatic

Definition at line 77558 of file NPC.cs.

77559 {
77560 if (amountWeWant <= 0)
77561 {
77562 return 0;
77563 }
77564 int num = 0;
77565 for (int i = 0; i < highestNPCSlotIndexWeWillPick; i++)
77566 {
77567 if (!Main.npc[i].active)
77568 {
77569 num++;
77570 if (num >= amountWeWant)
77571 {
77572 return amountWeWant;
77573 }
77574 }
77575 }
77576 return num;
77577 }

References Terraria.Main.npc.

Referenced by Terraria.WorldGen.CheckSuper(), Terraria.Item.GetShimmered(), and Terraria.Projectile.Kill().