Merge branch 'master' of https://github.com/Anuken/Mindustry into new-pathfinding

This commit is contained in:
Anuken
2023-11-19 18:32:14 -05:00
29 changed files with 244 additions and 189 deletions

View File

@@ -399,6 +399,8 @@ public class CommandAI extends AIController{
@Override
public void commandPosition(Vec2 pos){
if(pos == null) return;
commandPosition(pos, false);
if(commandController != null){
commandController.commandPosition(pos);
@@ -406,8 +408,10 @@ public class CommandAI extends AIController{
}
public void commandPosition(Vec2 pos, boolean stopWhenInRange){
targetPos = pos;
lastTargetPos = pos;
if(pos == null) return;
//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;