region height work

This commit is contained in:
2023-09-13 21:07:57 -05:00
parent 200318ddcf
commit 9b7fc0a93b
4 changed files with 14 additions and 36 deletions
+3 -1
View File
@@ -11,6 +11,7 @@ package engine.objects;
import engine.Enum;
import engine.Enum.*;
import engine.InterestManagement.HeightMap;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.exception.SerializationException;
@@ -986,8 +987,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public final void setLoc(final Vector3fImmutable value) {
Regions region = Regions.GetRegionForTeleport(value);
if(region != null){
float regionHeight = region.lerpY(this);
this.region = region;
Vector3fImmutable newValue = new Vector3fImmutable(value.x,value.y + region.lerpY(this),value.z); //account for height offset of the current character region
Vector3fImmutable newValue = new Vector3fImmutable(value.x,regionHeight,value.z); //account for height offset of the current character region
super.setLoc(newValue); // set the location in the world
this.resetLastSetLocUpdate();
} else {
+2 -1
View File
@@ -1649,7 +1649,7 @@ public class Mob extends AbstractIntelligenceAgent {
// Setup location for this Mobile
this.loc = new Vector3fImmutable(bindLoc);
this.setLoc(bindLoc);
this.endLoc = new Vector3fImmutable(bindLoc);
// Initialize inventory
@@ -1743,6 +1743,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.level = (short) newRank;
this.recalculateStats();
this.setHealth(this.healthMax);
this.setLoc(this.bindLoc);
}
public boolean isRanking() {
+1 -1
View File
@@ -865,7 +865,7 @@ public class NPC extends AbstractCharacter {
this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon);
this.bindLoc = this.parentZone.getLoc().add(this.bindLoc);
this.loc = new Vector3fImmutable(bindLoc);
this.setLoc(bindLoc);
// Handle NPCs within buildings