From 5729492c6a9ab7ce81b5d12d28bf146f936a5057 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 29 Apr 2023 10:30:53 -0400 Subject: [PATCH] NPC derives position from slot. --- src/engine/gameManager/BuildingManager.java | 8 +++++++- src/engine/objects/NPC.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index c362b3a5..a8b94e82 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -513,7 +513,7 @@ public enum BuildingManager { } if (NPC.ISGuardCaptain(contract.getContractID())) { - mob = Mob.createMob( contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank); + mob = Mob.createMob(contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank); if (mob == null) return false; @@ -523,6 +523,12 @@ public enum BuildingManager { mob.setParentZone(zone); return true; } + + // NPC in a Building derives position from slot + + if (building != null) + NpcLoc = Vector3fImmutable.ZERO; + npc = NPC.createNPC(pirateName, contract.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building); if (npc == null) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 51bf8be4..7fe202b8 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -387,7 +387,7 @@ public class NPC extends AbstractCharacter { // Configure region and floor/level for this NPC - this.region = BuildingManager.GetRegion(this.building, slotLocation.x, slotLocation.y, slotLocation.z); + this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); if (this.region != null) { this.buildingFloor = region.getRoom();