Browse Source

dev command work

hull4
FatBoy-DOTC 1 year ago
parent
commit
d7c7491746
  1. 15
      src/engine/devcmd/cmds/RegionCmd.java
  2. 2
      src/engine/mobileAI/utilities/MovementUtilities.java
  3. 10
      src/engine/objects/Building.java
  4. 19
      src/engine/objects/Zone.java

15
src/engine/devcmd/cmds/RegionCmd.java

@ -37,17 +37,16 @@ public class RegionCmd extends AbstractDevCmd {
} }
Regions region = ((AbstractCharacter)target).region; Regions region = ((AbstractCharacter)target).region;
if (region == null) { if (region == null) {
this.throwbackInfo(pc, "No Region Found."); output += "No Region Found." + newline;
return; }else{
}
if(region != null) {
output += "Player Info: " + ((AbstractCharacter) target).getName() + newline; output += "Player Info: " + ((AbstractCharacter) target).getName() + newline;
output += "Region Building: " + building.getName() + newline; output += "Region Building: " + building.getName() + newline;
output += "Region Height: " + region.lerpY((AbstractCharacter)target) + newline; output += "Region Height: " + region.lerpY((AbstractCharacter)target) + newline;
output += "is Stairs: " + region.isStairs() + newline; output += "is Stairs: " + region.isStairs() + newline;
output += "is Outside: " + region.isOutside(); output += "is Outside: " + region.isOutside() + newline;
output += "NavMesh Data" + newline; output += "NavMesh Data" + newline;
this.throwbackInfo(pc, output);
}
Zone zone = ZoneManager.findSmallestZone(((AbstractCharacter) target).loc); Zone zone = ZoneManager.findSmallestZone(((AbstractCharacter) target).loc);
if(zone != null) { if(zone != null) {
output += "zone: " + zone.zoneName + newline; output += "zone: " + zone.zoneName + newline;
@ -55,9 +54,7 @@ public class RegionCmd extends AbstractDevCmd {
}else { }else {
output += "zone: null" + newline; output += "zone: null" + newline;
} }
this.throwbackInfo(pc, output); this.throwbackInfo(pc, "No Region Found.");
}
} }
@Override @Override

2
src/engine/mobileAI/utilities/MovementUtilities.java

@ -34,7 +34,7 @@ import static engine.math.FastMath.sqr;
import static engine.math.FastMath.sqrt; import static engine.math.FastMath.sqrt;
public class MovementUtilities { public class MovementUtilities {
private static final int cellGap = 4; private static final int cellGap = 1;
public static boolean inRangeOfBindLocation(Mob agent) { public static boolean inRangeOfBindLocation(Mob agent) {

10
src/engine/objects/Building.java

@ -892,6 +892,7 @@ 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
@ -1529,4 +1530,13 @@ public class Building extends AbstractWorldObject {
public void RemoveFromBarracksList() { public void RemoveFromBarracksList() {
} }
public void updateNavMesh(){
for(Regions region : this.getBounds().getRegions())
this.parentZone.navMesh.add(region.getArea());
MeshBounds meshBounds = Bounds.meshBoundsCache.get(this.getMeshUUID());
if(meshBounds != null)
this.parentZone.navMesh.subtract(meshBounds.getArea());
}
} }

19
src/engine/objects/Zone.java

@ -16,7 +16,6 @@ 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;
@ -185,26 +184,18 @@ public class Zone extends AbstractWorldObject {
ZoneManager.populateZoneCollections(this); ZoneManager.populateZoneCollections(this);
this.bakeNavMesh(); this.createNavMesh();
} }
public void bakeNavMesh(){ public void createNavMesh(){
int xPoint = (int)(this.loc.x - this.bounds.getHalfExtents().x); Vector3fImmutable location = this.loc;
int zPoint = (int) (this.loc.z - this.bounds.getHalfExtents().y); int xPoint = (int)(location.x - this.bounds.getHalfExtents().x);
int zPoint = (int) (location.z - 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);
this.navMesh = new Area(new Rectangle(xPoint, zPoint, extentsX, extentsZ)); 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

Loading…
Cancel
Save