From f0027a3eff2c3a169220946016ee3bc1fe7f34c4 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 14 Sep 2024 09:43:30 -0400 Subject: [PATCH] Minor AI fix --- core/src/mindustry/ai/Pathfinder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index a18364e8f5..c6a2ed0528 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -470,12 +470,16 @@ public class Pathfinder implements Runnable{ for(int attempt = 0; attempt < 5 && max > 0; attempt++){ var targets = indexer.getEnemy(team, randomTargets[rand.random(randomTargets.length - 1)]); if(!targets.isEmpty()){ - max --; + boolean any = false; for(Building other : targets){ if((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput){ out.add(other.tile.array()); + any = true; } } + if(any){ + max --; + } } } }