Browse Source

property conforms to JSON

combat-2
MagicBot 1 year ago
parent
commit
1b2c218e83
  1. 12
      src/engine/InterestManagement/Terrain.java
  2. 2
      src/engine/devcmd/cmds/GetHeightCmd.java
  3. 2
      src/engine/devcmd/cmds/SeaAuditCmd.java
  4. 2
      src/engine/devcmd/cmds/ZoneInfoCmd.java
  5. 2
      src/engine/gameManager/ZoneManager.java
  6. 2
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java
  7. 6
      src/engine/objects/Zone.java

12
src/engine/InterestManagement/Terrain.java

@ -35,15 +35,15 @@ public class Terrain {
this.zone = zone; this.zone = zone;
this.heightmap = this.zone.terrain_image; this.heightmap = this.zone.terrain_image;
// Configure PLANAR zones to use the same // Configure PLANAR zones to use the same 16x16 pixel image
// 16x16 pixel image that all other flat // that all similar terrains share. (See JSON) Guild zones
// terrains share. // use an inverted clone of this heightmap.
if (this.zone.terrain_type.equals("PLANAR")) if (this.zone.terrain_type.equals("PLANAR"))
if (this.zone.guild_zone) if (this.zone.guild_zone)
this.heightmap = 1006301; this.heightmap = 1006301; // all 255
else else
this.heightmap = 1006300; this.heightmap = 1006300; // all 0
// Load pixel data for this terrain from cache // Load pixel data for this terrain from cache
@ -110,7 +110,7 @@ public class Terrain {
// Interpolate height for this position in terrain // Interpolate height for this position in terrain
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc); float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc);
interpolatedChildHeight += terrainZone.worldAltitude; interpolatedChildHeight += terrainZone.global_height;
return interpolatedChildHeight; return interpolatedChildHeight;
} }

2
src/engine/devcmd/cmds/GetHeightCmd.java

@ -44,7 +44,7 @@ public class GetHeightCmd extends AbstractDevCmd {
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName); this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
this.throwbackInfo(playerCharacter, "Global Height: " + heightmapZone.worldAltitude); this.throwbackInfo(playerCharacter, "Global Height: " + heightmapZone.global_height);
this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.seaLevel); this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.seaLevel);
this.throwbackInfo(playerCharacter, "Grid : " + Math.floor(gridSquare.x) + "x" + Math.floor(gridSquare.y)); this.throwbackInfo(playerCharacter, "Grid : " + Math.floor(gridSquare.x) + "x" + Math.floor(gridSquare.y));
this.throwbackInfo(playerCharacter, "Blend: " + heightmapZone.terrain.terrainBlend(zoneOffset)); this.throwbackInfo(playerCharacter, "Blend: " + heightmapZone.terrain.terrainBlend(zoneOffset));

2
src/engine/devcmd/cmds/SeaAuditCmd.java

@ -26,7 +26,7 @@ public class SeaAuditCmd extends AbstractDevCmd {
AbstractGameObject target) { AbstractGameObject target) {
for (Zone zone : ZoneManager.getAllZones()) for (Zone zone : ZoneManager.getAllZones())
if (zone.seaLevel > zone.worldAltitude) if (zone.seaLevel > zone.global_height)
this.throwbackInfo(playerCharacter, zone.getObjectUUID() + zone.zoneName); this.throwbackInfo(playerCharacter, zone.getObjectUUID() + zone.zoneName);
} }

2
src/engine/devcmd/cmds/ZoneInfoCmd.java

@ -101,7 +101,7 @@ public class ZoneInfoCmd extends AbstractDevCmd {
output += newline; output += newline;
output += "Sea Level = " + zone.seaLevel; output += "Sea Level = " + zone.seaLevel;
output += newline; output += newline;
output += "World Altitude = " + zone.worldAltitude; output += "World Altitude = " + zone.global_height;
throwbackInfo(player, output); throwbackInfo(player, output);
City city = ZoneManager.getCityAtLocation(player.getLoc()); City city = ZoneManager.getCityAtLocation(player.getLoc());

2
src/engine/gameManager/ZoneManager.java

@ -453,7 +453,7 @@ public enum ZoneManager {
} }
} }
public static float caclulateWorldAltitude(Zone zone) { public static float calculateGlobalZoneHeight(Zone zone) {
float worldAlttitude = MBServerStatics.SEA_FLOOR_ALTITUDE; float worldAlttitude = MBServerStatics.SEA_FLOOR_ALTITUDE;

2
src/engine/net/client/handlers/PlaceAssetMsgHandler.java

@ -792,7 +792,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
ZoneManager.addPlayerCityZone(zoneObject); ZoneManager.addPlayerCityZone(zoneObject);
serverZone.addNode(zoneObject); serverZone.addNode(zoneObject);
zoneObject.worldAltitude = ZoneManager.caclulateWorldAltitude(zoneObject); zoneObject.global_height = ZoneManager.calculateGlobalZoneHeight(zoneObject);
cityObject.setParent(zoneObject); cityObject.setParent(zoneObject);
cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already cityObject.setObjectTypeMask(MBServerStatics.MASK_CITY); // *** Refactor : should have it already

6
src/engine/objects/Zone.java

@ -56,7 +56,7 @@ public class Zone extends AbstractGameObject {
public boolean isNPCCity = false; public boolean isNPCCity = false;
public boolean guild_zone; public boolean guild_zone;
public String hash; public String hash;
public float worldAltitude = 0; public float global_height = 0;
public float seaLevel = 0f; public float seaLevel = 0f;
public float sea_level_offset = 0; public float sea_level_offset = 0;
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
@ -230,7 +230,7 @@ public class Zone extends AbstractGameObject {
} }
this.setBounds(); this.setBounds();
this.worldAltitude = ZoneManager.caclulateWorldAltitude(this); this.global_height = ZoneManager.calculateGlobalZoneHeight(this);
setSeaLevel(); setSeaLevel();
} }
@ -251,7 +251,7 @@ public class Zone extends AbstractGameObject {
this.sea_level = this.parent.sea_level + this.sea_level_offset; this.sea_level = this.parent.sea_level + this.sea_level_offset;
break; break;
case "SELF": case "SELF":
this.sea_level = this.worldAltitude + this.sea_level_offset; this.sea_level = this.global_height + this.sea_level_offset;
break; break;
} }
} }

Loading…
Cancel
Save