You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.6 KiB
81 lines
3.6 KiB
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . |
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· |
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ |
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ |
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ |
|
// Magicbane Emulator Project © 2013 - 2022 |
|
// www.magicbane.com |
|
|
|
|
|
package engine.devcmd.cmds; |
|
|
|
import engine.InterestManagement.HeightMap; |
|
import engine.devcmd.AbstractDevCmd; |
|
import engine.gameManager.ZoneManager; |
|
import engine.math.Bounds; |
|
import engine.math.Vector2f; |
|
import engine.objects.AbstractGameObject; |
|
import engine.objects.PlayerCharacter; |
|
import engine.objects.Zone; |
|
|
|
public class GetHeightCmd extends AbstractDevCmd { |
|
|
|
public GetHeightCmd() { |
|
super("getHeight"); |
|
} |
|
|
|
@Override |
|
protected void _doCmd(PlayerCharacter playerCharacter, String[] words, |
|
AbstractGameObject target) { |
|
|
|
Zone currentZone; |
|
Zone parentZone; |
|
Zone heightmapZone; |
|
|
|
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc()); |
|
heightmapZone = HeightMap.getNextZoneWithTerrain(currentZone); |
|
parentZone = HeightMap.getNextZoneWithTerrain(currentZone.getParent()); |
|
|
|
float currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc()); |
|
float parentHeight = HeightMap.getWorldHeight(parentZone, playerCharacter.getLoc()); |
|
|
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), heightmapZone); |
|
Vector2f gridSquare = heightmapZone.getHeightMap().getGridSquare(zoneLoc); |
|
|
|
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.getName()); |
|
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.getName()); |
|
this.throwbackInfo(playerCharacter, "Zone Height: " + heightmapZone.worldAltitude); |
|
this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.getSeaLevel()); |
|
this.throwbackInfo(playerCharacter, "Drowning Height: " + (heightmapZone.getSeaLevel() + playerCharacter.getCharacterHeight())); |
|
this.throwbackInfo(playerCharacter, "Grid : " + (int) gridSquare.x + "x" + (int) gridSquare.y); |
|
this.throwbackInfo(playerCharacter, "*** 256: " + currentHeight); |
|
this.throwbackInfo(playerCharacter, "***Adjusted Height: " + (currentHeight + playerCharacter.getCharacterHeight())); |
|
|
|
this.throwbackInfo(playerCharacter, "------------"); |
|
this.throwbackInfo(playerCharacter, "Parent : " + parentZone.getName()); |
|
this.throwbackInfo(playerCharacter, "Height returned : " + parentHeight); |
|
this.throwbackInfo(playerCharacter, "------------"); |
|
|
|
this.throwbackInfo(playerCharacter, "Min: " + heightmapZone.getHeightMap().zone_minBlend + " Max: " + heightmapZone.getHeightMap().zone_maxBlend); |
|
|
|
|
|
if (Bounds.collide(playerCharacter.getLoc(), heightmapZone.maxBlend)) { |
|
this.throwbackInfo(playerCharacter, "Blend: Max (Child)"); |
|
return; |
|
} |
|
|
|
this.throwbackInfo(playerCharacter, "Blend: Min (LERP)"); |
|
|
|
} |
|
|
|
@Override |
|
protected String _getHelpString() { |
|
return "Queries heightmap engine"; |
|
} |
|
|
|
@Override |
|
protected String _getUsageString() { |
|
return "' /getheight"; |
|
} |
|
|
|
}
|
|
|