FatBoy-DOTC 1 year ago
parent
commit
c63c5e6896
  1. 5
      src/engine/objects/Building.java
  2. 6
      src/engine/objects/MeshBounds.java
  3. 4
      src/engine/objects/Zone.java

5
src/engine/objects/Building.java

@ -892,7 +892,6 @@ public class Building extends AbstractWorldObject {
this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneUUID); this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneUUID);
this.parentZone.zoneBuildingSet.add(this); this.parentZone.zoneBuildingSet.add(this);
this.updateNavMesh(); // update the navmesh of the parent zone
// Lookup building blueprint // Lookup building blueprint
@ -1003,6 +1002,8 @@ public class Building extends AbstractWorldObject {
if (this.upgradeDateTime != null) if (this.upgradeDateTime != null)
BuildingManager.submitUpgradeJob(this); BuildingManager.submitUpgradeJob(this);
this.updateNavMesh(); // update the navmesh of the parent zone
} }
public synchronized boolean setOwner(AbstractCharacter newOwner) { public synchronized boolean setOwner(AbstractCharacter newOwner) {
@ -1537,6 +1538,6 @@ public class Building extends AbstractWorldObject {
MeshBounds meshBounds = Bounds.meshBoundsCache.get(this.getMeshUUID()); MeshBounds meshBounds = Bounds.meshBoundsCache.get(this.getMeshUUID());
if(meshBounds != null) if(meshBounds != null)
this.parentZone.navMesh.subtract(meshBounds.getArea()); this.parentZone.navMesh.subtract(meshBounds.getArea(this.loc.x,this.loc.z));
} }
} }

6
src/engine/objects/MeshBounds.java

@ -47,10 +47,10 @@ public class MeshBounds {
Bounds.meshBoundsCache = DbManager.BuildingQueries.LOAD_MESH_BOUNDS(); Bounds.meshBoundsCache = DbManager.BuildingQueries.LOAD_MESH_BOUNDS();
} }
public Area getArea(){ public Area getArea(float x, float z){
Polygon area = new Polygon(); Polygon area = new Polygon();
area.addPoint((int) this.minX, (int) this.minZ); area.addPoint((int)(x + this.minX), (int) (z + this.minZ));
area.addPoint((int) this.maxX, (int) this.maxZ); area.addPoint((int)(x + this.maxX), (int)(z + this.maxZ));
return new Area(area); return new Area(area);
} }
} }

4
src/engine/objects/Zone.java

@ -190,8 +190,8 @@ public class Zone extends AbstractWorldObject {
public void createNavMesh(){ public void createNavMesh(){
Vector3fImmutable location = this.loc; Vector3fImmutable location = this.loc;
int xPoint = (int)(location.x - this.bounds.getHalfExtents().x); int xPoint = (int)(this.absX - this.bounds.getHalfExtents().x);
int zPoint = (int) (location.z - this.bounds.getHalfExtents().y); int zPoint = (int) (this.absZ - this.bounds.getHalfExtents().y);
int extentsX = (int) (this.bounds.getHalfExtents().x * 2); int extentsX = (int) (this.bounds.getHalfExtents().x * 2);
int extentsZ = (int) (this.bounds.getHalfExtents().y * 2); int extentsZ = (int) (this.bounds.getHalfExtents().y * 2);

Loading…
Cancel
Save