Fixed static iframe respecting homing util

This commit is contained in:
Doze-Zoze committed 2025-08-20 17:54:09 -05:00
1 parent 256db6f7c3
commit cae9673d76
1 file changed
+3 -1
+3 -1
View File
@@ -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;