From 884482e9b645917ba6d31c6b90884415571e245f Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 6 Nov 2023 13:29:40 -0500 Subject: [PATCH] Fixed #9248 --- core/src/mindustry/ai/types/CommandAI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/ai/types/CommandAI.java b/core/src/mindustry/ai/types/CommandAI.java index a44b5b457c..b7054442a6 100644 --- a/core/src/mindustry/ai/types/CommandAI.java +++ b/core/src/mindustry/ai/types/CommandAI.java @@ -405,8 +405,8 @@ public class CommandAI extends AIController{ } public void commandPosition(Vec2 pos, boolean stopWhenInRange){ - targetPos = pos; - lastTargetPos = pos; + //this is an allocation, but it's relatively rarely called anyway, and outside mutations must be prevented + targetPos = lastTargetPos = pos.cpy(); attackTarget = null; pathId = Vars.controlPath.nextTargetId(); this.stopWhenInRange = stopWhenInRange;