forked from MagicBane/Server
shape
This commit is contained in:
@@ -14,6 +14,7 @@ import engine.math.Bounds;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.utilities.PathingUtilities;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
@@ -21,6 +22,7 @@ import engine.objects.ZoneTemplate;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.awt.geom.Path2D;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -433,4 +435,18 @@ public enum ZoneManager {
|
||||
|
||||
return localAltitude < zone.sea_level;
|
||||
}
|
||||
|
||||
public static void LinkNavNodes(){
|
||||
for(Zone zone : getAllZones()){
|
||||
for(PathingUtilities.Node node : zone.navNodes){
|
||||
for(PathingUtilities.Node potentialNeighbor : zone.navNodes){
|
||||
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.neighbors.add(potentialNeighbor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,6 +437,9 @@ public class WorldServer {
|
||||
DbManager.NPCQueries.GET_ALL_NPCS();
|
||||
DbManager.MobQueries.GET_ALL_MOBS();
|
||||
|
||||
Logger.info("Generating Neighbors for NavNodes");
|
||||
ZoneManager.LinkNavNodes();
|
||||
|
||||
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
||||
|
||||
// Configure realms for serialization
|
||||
|
||||
Reference in New Issue
Block a user