shape
This commit is contained in:
@@ -435,23 +435,4 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
return localAltitude < zone.sea_level;
|
return localAltitude < zone.sea_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LinkNavNodes(){
|
|
||||||
//TODO optimize
|
|
||||||
for(Zone zone : getAllZones()){
|
|
||||||
for(PathingUtilities.Node node : zone.navNodes){
|
|
||||||
for(PathingUtilities.Node potentialNeighbor : zone.navNodes){
|
|
||||||
try {
|
|
||||||
for (Path2D.Float obstacle : zone.navObstacles) {
|
|
||||||
if (!node.equals(potentialNeighbor) && !obstacle.intersects(node.location.x, node.location.y, potentialNeighbor.location.x, potentialNeighbor.location.y) && node.location.distance(potentialNeighbor.location) < 50) {
|
|
||||||
node.neighbors.add(potentialNeighbor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(Exception e){
|
|
||||||
Logger.error("Failed To Check Neighbors Of Node In Zone: " + zone.getObjectUUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package engine.mobileAI.utilities;
|
package engine.mobileAI.utilities;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Regions;
|
import engine.objects.Regions;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class PathingUtilities {
|
public class PathingUtilities {
|
||||||
@@ -18,6 +23,22 @@ public class PathingUtilities {
|
|||||||
this.parentBuilding = parent;
|
this.parentBuilding = parent;
|
||||||
this.neighbors = new ArrayList<>();
|
this.neighbors = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
public ArrayList<Node> getNeighbors(){
|
||||||
|
if(neighbors.size() == 0){
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(new Vector3fImmutable(this.location.x,0,this.location.y));
|
||||||
|
if(zone == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
for(Node potentialNeighbor : zone.navNodes){
|
||||||
|
for (Path2D.Float obstacle : zone.navObstacles) {
|
||||||
|
if (!this.equals(potentialNeighbor) && !obstacle.intersects(this.location.x, this.location.y, potentialNeighbor.location.x, potentialNeighbor.location.y) && this.location.distance(potentialNeighbor.location) < 65) {
|
||||||
|
this.neighbors.add(potentialNeighbor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.neighbors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -437,9 +437,6 @@ public class WorldServer {
|
|||||||
DbManager.NPCQueries.GET_ALL_NPCS();
|
DbManager.NPCQueries.GET_ALL_NPCS();
|
||||||
DbManager.MobQueries.GET_ALL_MOBS();
|
DbManager.MobQueries.GET_ALL_MOBS();
|
||||||
|
|
||||||
Logger.info("Generating Neighbors for NavNodes");
|
|
||||||
ZoneManager.LinkNavNodes();
|
|
||||||
|
|
||||||
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
||||||
|
|
||||||
// Configure realms for serialization
|
// Configure realms for serialization
|
||||||
|
|||||||
Reference in New Issue
Block a user