From cafec1386c5174cf8c006cea673ad79ee946c4f6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 23 Sep 2023 17:09:50 -0400 Subject: [PATCH] Patrol tweaks --- core/src/mindustry/ai/types/CommandAI.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/mindustry/ai/types/CommandAI.java b/core/src/mindustry/ai/types/CommandAI.java index b86345d888..65181c0884 100644 --- a/core/src/mindustry/ai/types/CommandAI.java +++ b/core/src/mindustry/ai/types/CommandAI.java @@ -213,6 +213,11 @@ public class CommandAI extends AIController{ boolean move = true; vecOut.set(targetPos); + //TODO: should the unit stop when it finds a target? + if(stance == UnitStance.patrol && target != null && unit.within(target, unit.type.range - 2f)){ + move = false; + } + if(unit.isGrounded() && stance != UnitStance.ram){ move = Vars.controlPath.getPathPosition(unit, pathId, targetPos, vecOut, noFound);