From 51e0098aa0aebf7b9f2f98048c64644002b48562 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 26 Oct 2023 20:33:22 -0500 Subject: [PATCH] counter added --- src/engine/devcmd/cmds/aiInfoCmd.java | 2 ++ src/engine/mobileAI/utilities/MovementUtilities.java | 4 +++- src/engine/objects/AbstractCharacter.java | 2 ++ src/engine/objects/Mob.java | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/devcmd/cmds/aiInfoCmd.java b/src/engine/devcmd/cmds/aiInfoCmd.java index ad515cea..0dcb72a5 100644 --- a/src/engine/devcmd/cmds/aiInfoCmd.java +++ b/src/engine/devcmd/cmds/aiInfoCmd.java @@ -150,6 +150,8 @@ public class aiInfoCmd extends AbstractDevCmd { for (Integer outlawUUID : outlaws) output += outlawUUID + newline; } + output += "Walking: " + ((Mob) target).isMoving() + newline; + output += "Destination: " + ((Mob) target).destination; throwbackInfo(playerCharacter, output); } diff --git a/src/engine/mobileAI/utilities/MovementUtilities.java b/src/engine/mobileAI/utilities/MovementUtilities.java index d2bcfdd1..6ec04955 100644 --- a/src/engine/mobileAI/utilities/MovementUtilities.java +++ b/src/engine/mobileAI/utilities/MovementUtilities.java @@ -331,7 +331,8 @@ private static final int cellGap = 4; path.add(start); Vector3fImmutable current = start; boolean obstructed = false; - while (current.distanceSquared(goal) > 9) + int count = 0; + while (current.distanceSquared(goal) > 9 && count < 250) { //gather the 8 cells around the player ArrayList surroundingCells = new ArrayList<>(); @@ -346,6 +347,7 @@ private static final int cellGap = 4; Vector3fImmutable cheapest = new Vector3fImmutable(-10000, 0, -10000); for (Vector3fImmutable point : surroundingCells) { + count++; if (path.contains(point)) continue; diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 788ac476..0c95e175 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -834,6 +834,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (this.isCasting && this.getObjectType().equals(GameObjectType.PlayerCharacter)) return false; + if(this.getObjectType().equals(GameObjectType.Mob) && ((Mob)this).destination.equals(Vector3fImmutable.ZERO)) + return false; return true; } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 5dd267a2..6346320c 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1901,5 +1901,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { return toIntExact(this.respawnTime - ((Mob) o).respawnTime); } - public void setDestination(Vector3fImmutable destination) {MovementUtilities.pathfind(this,destination);} + public void setDestination(Vector3fImmutable destination) { + MovementUtilities.pathfind(this,destination); + } }