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

◆ GetAvailableNPCSlot()

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

Definition at line 91288 of file NPC.cs.

91289 {
91290 bool num3 = Type >= 0 && NPCID.Sets.SpawnFromLastEmptySlot[Type];
91291 int t = 200;
91292 int num2 = 1;
91293 if (num3)
91294 {
91295 t--;
91296 Utils.Swap(ref startIndex, ref t);
91297 num2 = -1;
91298 }
91299 for (int i = startIndex; i != t; i += num2)
91300 {
91301 if (!Main.npc[i].active)
91302 {
91303 return i;
91304 }
91305 }
91306 for (int j = startIndex; j != t; j += num2)
91307 {
91308 if (Main.npc[j].CanBeReplacedByOtherNPCs)
91309 {
91310 return j;
91311 }
91312 }
91313 return -1;
91314 }
static bool[] SpawnFromLastEmptySlot
Whether or not the spawned NPC will start looking for a suitable slot from the end of F:Terraria....
Definition NPCID.cs:623
int IEntityWithGlobals< GlobalNPC >. Type
Definition NPC.cs:1573

References Terraria.Main.npc, and Terraria.ID.NPCID.Sets.SpawnFromLastEmptySlot.