From 3d64047a91c7db7a2ad5ffd856e604fecbad4b70 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 31 Jul 2022 00:30:37 -0400 Subject: [PATCH] Fixed Quad Repair AI --- core/src/mindustry/ai/types/BuilderAI.java | 2 +- core/src/mindustry/ai/types/RepairAI.java | 10 ++++++---- core/src/mindustry/type/UnitType.java | 5 +---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/ai/types/BuilderAI.java b/core/src/mindustry/ai/types/BuilderAI.java index dd88f09354..9185499755 100644 --- a/core/src/mindustry/ai/types/BuilderAI.java +++ b/core/src/mindustry/ai/types/BuilderAI.java @@ -115,7 +115,7 @@ public class BuilderAI extends AIController{ }else{ if(assistFollowing != null){ - moveTo(assistFollowing, assistFollowing.type.hitSize * 1.5f + 60f); + moveTo(assistFollowing, assistFollowing.type.hitSize + unit.type.hitSize/2f + 60f); } //follow someone and help them build diff --git a/core/src/mindustry/ai/types/RepairAI.java b/core/src/mindustry/ai/types/RepairAI.java index 14905a9ad7..5aa7607b2c 100644 --- a/core/src/mindustry/ai/types/RepairAI.java +++ b/core/src/mindustry/ai/types/RepairAI.java @@ -28,12 +28,14 @@ public class RepairAI extends AIController{ unit.controlWeapons(false); } - if(target != null){ - if(!target.within(unit, unit.type.range * 0.65f) && target instanceof Building b && b.team == unit.team){ + if(target != null && target instanceof Building b && b.team == unit.team){ + if(unit.type.circleTarget){ + circleAttack(120f); + }else if(!target.within(unit, unit.type.range * 0.65f)){ moveTo(target, unit.type.range * 0.65f); - } - unit.lookAt(target); + unit.lookAt(target); + } } //not repairing diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 7142bfff45..a9fbf5d68a 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -781,10 +781,7 @@ public class UnitType extends UnlockableContent{ if(commands.length == 0){ Seq cmds = new Seq<>(UnitCommand.class); - //TODO ???? - //if(canAttack){ - cmds.add(UnitCommand.moveCommand); - //} + cmds.add(UnitCommand.moveCommand); //healing, mining and building is only supported for flying units; pathfinding to ambiguously reachable locations is hard. if(flying){