Browse Source

shape

hull4
FatBoy-DOTC 12 months ago
parent
commit
d482265994
  1. 8
      src/engine/devcmd/cmds/aiInfoCmd.java
  2. 2
      src/engine/gameManager/NavigationManager.java
  3. 9
      src/engine/mobileAI/utilities/PathingUtilities.java
  4. 3
      src/engine/objects/AbstractCharacter.java

8
src/engine/devcmd/cmds/aiInfoCmd.java

@ -15,6 +15,7 @@ import engine.devcmd.AbstractDevCmd; @@ -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 { @@ -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);
}

2
src/engine/gameManager/NavigationManager.java

@ -25,7 +25,7 @@ public class NavigationManager { @@ -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

9
src/engine/mobileAI/utilities/PathingUtilities.java

@ -30,6 +30,12 @@ public class PathingUtilities { @@ -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<Node>) clone.neighbors.clone();
}
public ArrayList<Node> 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 { @@ -69,7 +75,7 @@ public class PathingUtilities {
ArrayList<Node> 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 { @@ -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;

3
src/engine/objects/AbstractCharacter.java

@ -25,6 +25,7 @@ import engine.jobs.TrackJob; @@ -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 { @@ -127,7 +128,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public ArrayList<CharacterRune> runes;
public ArrayList<Vector3fImmutable> navPath = new ArrayList<>();
public ArrayList<PathingUtilities.Node> navPath = new ArrayList<>();
public boolean isPathing = false;
public AbstractCharacter() {

Loading…
Cancel
Save