|
|
@ -9,17 +9,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
package engine.objects; |
|
|
|
package engine.objects; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.geom.Area; |
|
|
|
import engine.Enum; |
|
|
|
import engine.Enum; |
|
|
|
import engine.InterestManagement.Terrain; |
|
|
|
import engine.InterestManagement.Terrain; |
|
|
|
import engine.db.archive.DataWarehouse; |
|
|
|
import engine.db.archive.DataWarehouse; |
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Vector2f; |
|
|
|
import engine.math.Vector2f; |
|
|
|
|
|
|
|
import engine.math.Vector3f; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.net.ByteBufferWriter; |
|
|
|
import engine.net.ByteBufferWriter; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -65,6 +67,8 @@ public class Zone extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
public Terrain terrain = null; |
|
|
|
public Terrain terrain = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Area navMesh; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* ResultSet Constructor |
|
|
|
* ResultSet Constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -181,8 +185,27 @@ public class Zone extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
ZoneManager.populateZoneCollections(this); |
|
|
|
ZoneManager.populateZoneCollections(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.bakeNavMesh(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void bakeNavMesh(){ |
|
|
|
|
|
|
|
int xPoint = (int)(this.loc.x - this.bounds.getHalfExtents().x); |
|
|
|
|
|
|
|
int zPoint = (int) (this.loc.z - this.bounds.getHalfExtents().y); |
|
|
|
|
|
|
|
int extentsX = (int) (this.bounds.getHalfExtents().x * 2); |
|
|
|
|
|
|
|
int extentsZ = (int) (this.bounds.getHalfExtents().y * 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.navMesh = new Area(new Rectangle(xPoint, zPoint, extentsX, extentsZ)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(Building building : this.zoneBuildingSet){ |
|
|
|
|
|
|
|
for(Regions region : building.getBounds().getRegions()) |
|
|
|
|
|
|
|
this.navMesh.add(region.getArea()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MeshBounds meshBounds = Bounds.meshBoundsCache.get(building.getMeshUUID()); |
|
|
|
|
|
|
|
if(meshBounds != null) |
|
|
|
|
|
|
|
this.navMesh.subtract(meshBounds.getArea()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/* Method sets a default value for player cities |
|
|
|
/* Method sets a default value for player cities |
|
|
|
* otherwise using values derived from the loadnum |
|
|
|
* otherwise using values derived from the loadnum |
|
|
|
* field in the obj_zone database table. |
|
|
|
* field in the obj_zone database table. |
|
|
|