From 9b7ac713ee517967d52023a662f5546dbf1299f1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Sep 2022 21:54:57 -0400 Subject: [PATCH] DefenderAI tweaks --- core/src/mindustry/ai/types/DefenderAI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ai/types/DefenderAI.java b/core/src/mindustry/ai/types/DefenderAI.java index d16e1ac907..01c38e69c6 100644 --- a/core/src/mindustry/ai/types/DefenderAI.java +++ b/core/src/mindustry/ai/types/DefenderAI.java @@ -28,7 +28,8 @@ public class DefenderAI extends AIController{ public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){ //Sort by max health and closer target. - var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type && u.targetable(unit.team), (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f); + var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type && u.targetable(unit.team) && u.type.playerControllable, + (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f); if(result != null) return result; //return core if found