From a01a342fd828be09b816d9125c8af2416c237c47 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 4 Apr 2023 13:48:56 -0400 Subject: [PATCH] Affirmatively check hireling entry instead of relying upon loadID =0 which was a side effect. --- src/engine/objects/Mob.java | 3 ++- src/engine/objects/NPC.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 40105e64..da895a12 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -807,7 +807,8 @@ public class Mob extends AbstractIntelligenceAgent { // only if this building has a blueprint. // otherwise use the mob cache location. - if (this.building != null && building.getBlueprintUUID() != 0) { + if (this.building != null && building.getBlueprintUUID() != 0 + && this.building.getHirelings().contains(this) == false) { int maxSlots = 10; diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index e026cd25..b69f2bea 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -352,9 +352,12 @@ public class NPC extends AbstractCharacter { this.stamina.set(this.staminaMax); } - //add this npc to building + // Add this npc to building hireling list if not there yet. + // For some reason the mob is initialized twice when + // createMobWithNoID() is called. - if (this.building != null) { + if (this.building != null && + this.building.getHirelings().contains(this) == false) { int maxSlots = 10;