diff --git a/src/engine/devcmd/cmds/aiInfoCmd.java b/src/engine/devcmd/cmds/aiInfoCmd.java index 2f3bdc3f..a6ae11bf 100644 --- a/src/engine/devcmd/cmds/aiInfoCmd.java +++ b/src/engine/devcmd/cmds/aiInfoCmd.java @@ -15,6 +15,7 @@ import engine.devcmd.AbstractDevCmd; import engine.gameManager.PowersManager; import engine.math.Vector3fImmutable; import engine.mobileAI.MobAI; +import engine.mobileAI.utilities.PathingUtilities; import engine.objects.AbstractGameObject; import engine.objects.Mob; import engine.objects.PlayerCharacter; @@ -153,11 +154,12 @@ public class aiInfoCmd extends AbstractDevCmd { } output += "Walking: " + ((Mob) target).isMoving() + newline; output += "Destination: " + ((Mob) target).destination + newline; + output += "is Pathing: " + mob.isPathing + newline; output += "NavPath: " + newline; - for(Vector3fImmutable point : ((Mob) target).navPath){ - output += "(" + ((Mob) target).navPath.indexOf(point) + ")(" +((Mob) target).loc.distanceSquared2D(point) + ") "+ point + newline; + for(PathingUtilities.Node point : ((Mob) target).navPath){ + output += point.location + newline; } - + ((Mob) target).isPathing = false; throwbackInfo(playerCharacter, output); } diff --git a/src/engine/gameManager/NavigationManager.java b/src/engine/gameManager/NavigationManager.java index 68862d99..74a4681d 100644 --- a/src/engine/gameManager/NavigationManager.java +++ b/src/engine/gameManager/NavigationManager.java @@ -25,7 +25,7 @@ public class NavigationManager { MobAI.directMove((Mob)character,character.combatTarget != null); return; //no points to walk to } - character.navPath = path; + //character.navPath = path; } catch (Exception e) { //something failed diff --git a/src/engine/mobileAI/utilities/PathingUtilities.java b/src/engine/mobileAI/utilities/PathingUtilities.java index f10d57ec..dd4d447f 100644 --- a/src/engine/mobileAI/utilities/PathingUtilities.java +++ b/src/engine/mobileAI/utilities/PathingUtilities.java @@ -30,6 +30,12 @@ public class PathingUtilities { this.parentBuilding = parent; this.neighbors = new ArrayList<>(); } + public Node(Node clone){ + this.location = clone.location; + this.region = clone.region; + this.parentBuilding = clone.parentBuilding; + this.neighbors = (ArrayList) clone.neighbors.clone(); + } public ArrayList getNeighbors(){ if(neighbors.size() == 0){ Zone zone = ZoneManager.findSmallestZone(new Vector3fImmutable(this.location.x,0,this.location.y)); @@ -69,7 +75,7 @@ public class PathingUtilities { ArrayList path = new ArrayList<>(); Node startNode = getClosestNode(start); Node goalNode = getClosestNode(goal); - Node currentNode = startNode; + Node currentNode = new Node(startNode); path.add(startNode); int attempts = 0; while(!currentNode.equals(goalNode) && attempts < 250){ @@ -112,6 +118,7 @@ public class PathingUtilities { move(character,new Vector3fImmutable(path.get(0).location.x,0,path.get(0).location.y)); path.remove(0); } + character.isPathing = false; } public static void move(AbstractCharacter mob, Vector3fImmutable goal) { mob.destination = goal; diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index da799af2..e881808d 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -25,6 +25,7 @@ import engine.jobs.TrackJob; import engine.math.AtomicFloat; import engine.math.Bounds; import engine.math.Vector3fImmutable; +import engine.mobileAI.utilities.PathingUtilities; import engine.net.ByteBufferWriter; import engine.net.DispatchMessage; import engine.net.client.msg.ErrorPopupMsg; @@ -127,7 +128,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { public ArrayList runes; - public ArrayList navPath = new ArrayList<>(); + public ArrayList navPath = new ArrayList<>(); public boolean isPathing = false; public AbstractCharacter() {