photo LC flares home on nearest npc instead of final in array
This commit is contained in:
1 parent
2bd4805047
commit
25e1febe93
1 file changed
+10
-1
@@ -82,10 +82,19 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.GetLerpValue(0f, 25f, Time, true));
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
float currentDist = 25000f;
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (n.CanBeChasedBy(Projectile.GetSource_FromThis(), false))
|
||||
NPCDestination = n.Center + n.velocity * 5f;
|
||||
{
|
||||
Vector2 potentialDest = n.Center + n.velocity * 5f;
|
||||
float newDist = potentialDest.Distance(Projectile.Center);
|
||||
if (newDist < currentDist)
|
||||
{
|
||||
currentDist = newDist;
|
||||
NPCDestination = potentialDest;
|
||||
}
|
||||
}
|
||||
}
|
||||
InitialCenter = Projectile.Center;
|
||||
Projectile.localAI[0] = 1f;
|
||||
|
||||
Reference in new issue
Block a user