fixed breathing
This commit is contained in:
@@ -335,9 +335,9 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "Movement State: " + targetPC.getMovementState().name();
|
output += "Movement State: " + targetPC.getMovementState().name();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Movement Speed: " + targetPC.getSpeed();
|
output += "Movement Speed: " + targetPC.getSpeed();
|
||||||
|
output += newline;
|
||||||
output += "Altitude : " + targetPC.getLoc().y;
|
output += "Altitude : " + targetPC.getLoc().y;
|
||||||
|
output += newline;
|
||||||
output += "Swimming : " + targetPC.isSwimming();
|
output += "Swimming : " + targetPC.isSwimming();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "isMoving : " + targetPC.isMoving();
|
output += "isMoving : " + targetPC.isMoving();
|
||||||
|
|||||||
@@ -1535,25 +1535,48 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
return true;
|
return true;
|
||||||
Zone zone = ZoneManager.findSmallestZone(breather.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(breather.getLoc());
|
||||||
|
|
||||||
|
if(zone == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(zone.isPlayerCity())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
float seaLevel = zone.getSeaLevel();
|
||||||
|
|
||||||
if (zone.getSeaLevel() != 0) {
|
if (zone.getSeaLevel() != 0) {
|
||||||
|
Zone parent = zone.getParent();
|
||||||
|
if(parent != null && parent.isMacroZone()){
|
||||||
|
float parentLevel = parent.getSeaLevel();
|
||||||
|
seaLevel -= parentLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(seaLevel == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
float localAltitude = breather.getLoc().y;
|
float localAltitude = breather.getLoc().y;
|
||||||
|
float characterHeight = breather.characterHeight;
|
||||||
|
|
||||||
|
if (localAltitude + characterHeight < seaLevel - 2) {
|
||||||
if (localAltitude + breather.characterHeight < zone.getSeaLevel() - 2)
|
//ChatManager.chatSystemInfo(breather, "YOU CANNOT BREATHE!");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (breather.isMoving()) {
|
if (breather.isMoving()) {
|
||||||
if (localAltitude + breather.characterHeight < zone.getSeaLevel())
|
if (localAltitude + breather.characterHeight < zone.getSeaLevel()) {
|
||||||
|
//ChatManager.chatSystemInfo(breather, "YOU CANNOT BREATHE!");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (breather.getLoc().y + breather.characterHeight < -2)
|
if (breather.getLoc().y + breather.characterHeight < -2) {
|
||||||
|
//ChatManager.chatSystemInfo(breather, "YOU CANNOT BREATHE!");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (breather.isMoving()) {
|
if (breather.isMoving()) {
|
||||||
if (breather.getLoc().y + breather.characterHeight < 0)
|
if (breather.getLoc().y + breather.characterHeight < 0) {
|
||||||
|
//ChatManager.chatSystemInfo(breather, "YOU CANNOT BREATHE!");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5083,6 +5106,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
||||||
|
|
||||||
|
if(zone == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(zone.isPlayerCity())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (zone.getSeaLevel() != 0) {
|
if (zone.getSeaLevel() != 0) {
|
||||||
|
|
||||||
float localAltitude = this.getLoc().y + this.centerHeight;
|
float localAltitude = this.getLoc().y + this.centerHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user