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

◆ GetAvailableNPCSlot()

static int Terraria.NPC.GetAvailableNPCSlot ( int Type,
int startIndex )
inlinestaticprivate

Definition at line 77700 of file NPC.cs.

77701 {
77702 bool num = Type == 222 || Type == 245;
77703 int t = 200;
77704 int num2 = 1;
77705 if (num)
77706 {
77707 t--;
77708 Utils.Swap(ref startIndex, ref t);
77709 num2 = -1;
77710 }
77711 for (int i = startIndex; i != t; i += num2)
77712 {
77713 if (!Main.npc[i].active)
77714 {
77715 return i;
77716 }
77717 }
77718 for (int j = startIndex; j != t; j += num2)
77719 {
77720 if (Main.npc[j].CanBeReplacedByOtherNPCs)
77721 {
77722 return j;
77723 }
77724 }
77725 return -1;
77726 }

References Terraria.Main.npc, and System.startIndex.