Fixed static iframe respecting homing util
This commit is contained in:
1 parent
256db6f7c3
commit
cae9673d76
1 file changed
+3
-1
@@ -184,10 +184,12 @@ namespace CalamityMod
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
float extraDistance = (n.width / 2) + (n.height / 2);
|
||||
if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance) || (respectIFrames && (projectile.localNPCImmunity[n.whoAmI] > 0 || n.immune[projectile.owner] > 0 || Projectile.perIDStaticNPCImmunity[projectile.type][n.whoAmI] > 0)))
|
||||
if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance) || (respectIFrames && (projectile.localNPCImmunity[n.whoAmI] > 0 || projectile.localNPCImmunity[n.whoAmI] == -1 || n.immune[projectile.owner] > 0)))
|
||||
continue;
|
||||
|
||||
float currentNPCDist = Vector2.Distance(n.Center, projectile.Center);
|
||||
if (respectIFrames && Projectile.perIDStaticNPCImmunity[projectile.type][n.whoAmI] > Main.GameUpdateCount)
|
||||
currentNPCDist += 1600; //Prioritize things that don't currently have iframes, but still home in on stuff that has static iframes if needed.
|
||||
if ((currentNPCDist < npcDistCompare) && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1)))
|
||||
{
|
||||
npcDistCompare = currentNPCDist;
|
||||
|
||||
Reference in new issue
Block a user