mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-14 17:57:56 +07:00
DefenderAI tweaks
This commit is contained in:
@ -28,7 +28,8 @@ public class DefenderAI extends AIController{
|
|||||||
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
|
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
|
||||||
|
|
||||||
//Sort by max health and closer target.
|
//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;
|
if(result != null) return result;
|
||||||
|
|
||||||
//return core if found
|
//return core if found
|
||||||
|
Reference in New Issue
Block a user