forked from MagicBane/Server
Dev command updated
This commit is contained in:
@@ -184,7 +184,7 @@ public class Terrain {
|
|||||||
|
|
||||||
// Normalize terrain offset
|
// Normalize terrain offset
|
||||||
|
|
||||||
Vector2f normalizedLoc = new Vector2f(Math.abs(zone_offset.x) / this.terrain_size.x,
|
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.terrain_size.x,
|
||||||
Math.abs(zone_offset.y) / terrain_size.y);
|
Math.abs(zone_offset.y) / terrain_size.y);
|
||||||
|
|
||||||
float xval;
|
float xval;
|
||||||
@@ -203,14 +203,14 @@ public class Terrain {
|
|||||||
|
|
||||||
float value;
|
float value;
|
||||||
|
|
||||||
if (normalizedLoc.x <= 1 - xval || normalizedLoc.x <= normalizedLoc.y) {
|
if (normalizedOffset.x <= 1 - xval || normalizedOffset.x <= normalizedOffset.y) {
|
||||||
|
|
||||||
if (normalizedLoc.y < 1 - yval)
|
if (normalizedOffset.y < 1 - yval)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
value = (normalizedLoc.y - (1 - yval)) / yval;
|
value = (normalizedOffset.y - (1 - yval)) / yval;
|
||||||
} else
|
} else
|
||||||
value = (normalizedLoc.x - (1 - xval)) / xval;
|
value = (normalizedOffset.x - (1 - xval)) / xval;
|
||||||
|
|
||||||
value = (float) Math.atan((0.5f - value) * PI);
|
value = (float) Math.atan((0.5f - value) * PI);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
|
Vector2f zoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
|
||||||
Vector2f zoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
|
Vector2f zoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
|
||||||
|
Vector2f normalizedOffset = new Vector2f(Math.abs(zoneOffset.x) / heightmapZone.terrain.terrain_size.x,
|
||||||
|
Math.abs(zoneOffset.y) / heightmapZone.terrain.terrain_size.y);
|
||||||
|
|
||||||
Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(zoneLoc);
|
Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(zoneLoc);
|
||||||
gridSquare.x = (float) Math.floor(gridSquare.x);
|
gridSquare.x = (float) Math.floor(gridSquare.x);
|
||||||
gridSquare.y = (float) Math.floor(gridSquare.y);
|
gridSquare.y = (float) Math.floor(gridSquare.y);
|
||||||
@@ -49,7 +52,7 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
this.throwbackInfo(playerCharacter, "Global Height: " + heightmapZone.global_height);
|
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 : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]");
|
this.throwbackInfo(playerCharacter, "Grid : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]");
|
||||||
this.throwbackInfo(playerCharacter, "Offset: " + "[" + zoneOffset.x + "]" + "[" + zoneOffset.y + "]");
|
this.throwbackInfo(playerCharacter, "Offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]");
|
||||||
this.throwbackInfo(playerCharacter, "Blend: " + heightmapZone.terrain.terrainBlend(zoneOffset));
|
this.throwbackInfo(playerCharacter, "Blend: " + heightmapZone.terrain.terrainBlend(zoneOffset));
|
||||||
this.throwbackInfo(playerCharacter, "Height returned: " + Math.ceil(currentHeight));
|
this.throwbackInfo(playerCharacter, "Height returned: " + Math.ceil(currentHeight));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user