From 3c6fc363f390a26c23e0082a74bd19c802815e84 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 21 Oct 2023 15:18:57 -0400 Subject: [PATCH] Fixed load block command not arriving on target --- core/src/mindustry/ai/UnitCommand.java | 3 +++ core/src/mindustry/ai/types/CommandAI.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/ai/UnitCommand.java b/core/src/mindustry/ai/UnitCommand.java index ef5f382cd0..51a0edfcf8 100644 --- a/core/src/mindustry/ai/UnitCommand.java +++ b/core/src/mindustry/ai/UnitCommand.java @@ -29,6 +29,8 @@ public class UnitCommand extends MappableContent{ public boolean drawTarget = false; /** Whether to reset targets when switching to or from this command. */ public boolean resetTarget = true; + /** */ + public boolean exactArrival = false; /** Key to press for this command. */ public @Nullable Binding keybind = null; @@ -101,6 +103,7 @@ public class UnitCommand extends MappableContent{ switchToMove = false; drawTarget = true; resetTarget = false; + exactArrival = true; }}; unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unit_command_unload_payload, null){{ switchToMove = false; diff --git a/core/src/mindustry/ai/types/CommandAI.java b/core/src/mindustry/ai/types/CommandAI.java index 84475dc23b..a44b5b457c 100644 --- a/core/src/mindustry/ai/types/CommandAI.java +++ b/core/src/mindustry/ai/types/CommandAI.java @@ -40,7 +40,7 @@ public class CommandAI extends AIController{ /** Stance, usually related to firing mode. */ public UnitStance stance = UnitStance.shoot; /** Current command this unit is following. */ - public @Nullable UnitCommand command; + public UnitCommand command = UnitCommand.moveCommand; /** Current controller instance based on command. */ protected @Nullable AIController commandController; /** Last command type assigned. Used for detecting command changes. */ @@ -291,7 +291,7 @@ public class CommandAI extends AIController{ } //reached destination, end pathfinding - if(attackTarget == null && unit.within(vecMovePos, Math.max(5f, unit.hitSize / 2f))){ + if(attackTarget == null && unit.within(vecMovePos, command.exactArrival && commandQueue.size == 0 ? 1f : Math.max(5f, unit.hitSize / 2f))){ finishPath(); }