From 84e24b4951f340c00fbf1cc41f2a5061e63fe667 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 29 Apr 2023 09:17:14 -0400 Subject: [PATCH] Set bindloc to slot location. --- src/engine/objects/NPC.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 699bb058..3d009033 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -341,7 +341,7 @@ public class NPC extends AbstractCharacter { private void initializeNPC() { int slot; - Vector3fImmutable bindLocation = Vector3fImmutable.ZERO; + Vector3fImmutable slotLocation = Vector3fImmutable.ZERO; if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) return; @@ -362,8 +362,7 @@ public class NPC extends AbstractCharacter { this.bindLoc = this.parentZone.getLoc().add(this.bindLoc); this.loc = bindLoc; - // Add this npc to the hireling list. - // if slotted within a building + // Handle NPCs within buildings if (this.building != null) { @@ -374,9 +373,12 @@ public class NPC extends AbstractCharacter { building.getHirelings().put(this, slot); - this.bindLoc = BuildingManager.getSlotLocation(building, slot); - this.loc = BuildingManager.getSlotLocation(building, slot); - this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); + slotLocation = BuildingManager.getSlotLocation(building, slot); + + this.bindLoc = building.getLoc().add(slotLocation); + this.loc = building.getLoc().add(slotLocation); + ; + this.region = BuildingManager.GetRegion(this.building, slotLocation.x, slotLocation.y, slotLocation.z); if (this.region != null) { this.buildingFloor = region.getRoom();