From 6c29460ade529d5a9f236f2f7e9b77da85e3b80c Mon Sep 17 00:00:00 2001 From: Sh1p*nfire <73347888+Sh1penfire@users.noreply.github.com> Date: Mon, 2 Jun 2025 01:49:03 +1000 Subject: [PATCH] Fix randomWaveAI causing units to target untargetable blocks (#10870) * Update Pathfinder.java * Update FlyingAI.java --- core/src/mindustry/ai/Pathfinder.java | 2 +- core/src/mindustry/ai/types/FlyingAI.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index 1b095760ca..2c950e8636 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -540,7 +540,7 @@ public class Pathfinder implements Runnable{ if(!targets.isEmpty()){ boolean any = false; for(Building other : targets){ - if((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput){ + if(((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput) && other.block.targetable){ out.add(other.tile.array()); any = true; } diff --git a/core/src/mindustry/ai/types/FlyingAI.java b/core/src/mindustry/ai/types/FlyingAI.java index a412c6f4da..c328b41b41 100644 --- a/core/src/mindustry/ai/types/FlyingAI.java +++ b/core/src/mindustry/ai/types/FlyingAI.java @@ -41,7 +41,7 @@ public class FlyingAI extends AIController{ Building closest = null; float cdist = 0f; for(Building t : list){ - if((t.items != null && t.items.any()) || t.status() != BlockStatus.noInput){ + if(((t.items != null && t.items.any()) || t.status() != BlockStatus.noInput) && t.block.targetable){ float dst = t.dst2(x, y); if(closest == null || dst < cdist){ closest = t;