Completed partial refactor.

This commit is contained in:
2023-10-08 09:59:13 -04:00
parent 4b62517d99
commit df54840a88
6 changed files with 27 additions and 72 deletions
+19 -18
View File
@@ -58,6 +58,7 @@ public class Zone extends AbstractGameObject {
public String hash;
public float worldAltitude = 0;
public float seaLevel = 0f;
public float sea_level_offset = 0;
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
public static long lastRespawn = 0;
public float major_radius;
@@ -224,21 +225,29 @@ public class Zone extends AbstractGameObject {
this.setBounds();
this.worldAltitude = ZoneManager.caclulateWorldAltitude(this);
setSeaLevel();
}
private void setSeaLevel() {
int world_sea_level = 0;
if (this.parent == null) {
this.seaLevel = MBServerStatics.SEA_FLOOR_ALTITUDE;
this.sea_level = world_sea_level;
return;
}
if (this.getHeightMap() == null) {
this.seaLevel = this.parent.seaLevel;
return;
switch (this.sea_level_type) {
case "WORLD":
this.sea_level = world_sea_level + this.sea_level_offset;
break;
case "PARENT":
this.sea_level = this.parent.sea_level + this.sea_level_offset;
break;
case "SELF":
this.sea_level = this.worldAltitude + this.sea_level_offset;
break;
}
if (this.getHeightMap().seaLevel != 0)
this.seaLevel = this.worldAltitude + this.getHeightMap().seaLevel;
else
this.seaLevel = this.parent.seaLevel;
}
public boolean isMacroZone() {
@@ -315,12 +324,4 @@ public class Zone extends AbstractGameObject {
// Return heightmap for this Zone.
public Terrain getHeightMap() {
if (this.guild_zone)
return Terrain.playerCityTerrain;
return Terrain.heightmapByLoadNum.get(this.template);
}
}