From 7654d5183ae8e6d8a2c237a417dc49e80c9edcec Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 13 Sep 2023 21:28:20 -0500 Subject: [PATCH] region lookup and height offset for AbstractCharacters when setLoc is called --- src/engine/objects/AbstractWorldObject.java | 8 +++++++- src/engine/objects/Mob.java | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/AbstractWorldObject.java b/src/engine/objects/AbstractWorldObject.java index 0ea3c6b4..cb647707 100644 --- a/src/engine/objects/AbstractWorldObject.java +++ b/src/engine/objects/AbstractWorldObject.java @@ -502,7 +502,13 @@ public abstract class AbstractWorldObject extends AbstractGameObject { return; this.lastLoc = new Vector3fImmutable(this.loc); this.loc = loc; - this.loc = this.loc.setY(HeightMap.getWorldHeight(this.getLoc()) + this.getAltitude()); + + if(this instanceof AbstractCharacter && this.region != null){ + this.loc = this.loc.setY(this.region.lerpY(this) + this.getAltitude()); + } else{ + this.loc = this.loc.setY(HeightMap.getWorldHeight(this.getLoc()) + this.getAltitude()); + } + //lets not add mob to world grid if he is currently despawned. if (this.getObjectType().equals(GameObjectType.Mob) && ((Mob) this).despawned) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index a7528f9e..532a6aeb 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1743,7 +1743,6 @@ public class Mob extends AbstractIntelligenceAgent { this.level = (short) newRank; this.recalculateStats(); this.setHealth(this.healthMax); - this.setLoc(this.bindLoc); } public boolean isRanking() {