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

◆ AI_120_StardustGuardian_FindTarget()

void Terraria.Projectile.AI_120_StardustGuardian_FindTarget ( float lookupRange,
ref int targetNPCIndex,
ref float distanceToClosestTarget )
inlineprivate

Definition at line 47166 of file Projectile.cs.

47167 {
47168 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
47169 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
47170 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
47171 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
47172 Vector2 center = Main.player[owner].Center;
47173 for (int i = 0; i < 200; i++)
47174 {
47175 NPC nPC = Main.npc[i];
47176 if (nPC.CanBeChasedBy(this))
47177 {
47178 float num = center.Distance(nPC.Center);
47179 if (num < lookupRange)
47180 {
47181 targetNPCIndex = i;
47183 lookupRange = num;
47184 }
47185 }
47186 }
47187 }
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...

References Terraria.Main.npc, and Terraria.Main.player.