From 1738f7b311905a621521e42b45664e324958f095 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 23 Aug 2023 12:38:46 -0400 Subject: [PATCH] Starting to whittle away at initmob method. --- src/engine/objects/Mob.java | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 6b683cf4..051f4a9d 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -833,33 +833,6 @@ public class Mob extends AbstractIntelligenceAgent { if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) return; - // Configure parent zone adding this NPC to the - // zone collection - - this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneID); - this.parentZone.zoneMobSet.remove(this); - this.parentZone.zoneMobSet.add(this); - - // Setup location for this Mobile - - this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon); - this.bindLoc = this.parentZone.getLoc().add(this.bindLoc); - this.loc = new Vector3fImmutable(bindLoc); - this.endLoc = new Vector3fImmutable(bindLoc); - - // Handle Mobiles within buildings - - if (this.building != null) { - - // Mobiles inside buildings are offset from it not the zone - - this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon); - this.bindLoc = this.building.getLoc().add(this.bindLoc); - - if (this.contract != null || this.isSiege) - NPCManager.slotCharacterInBuilding(this); - } - if (this.mobBase != null) { this.gridObjectType = GridObjectType.DYNAMIC; this.healthMax = this.mobBase.getHealthMax(); @@ -1885,6 +1858,35 @@ public class Mob extends AbstractIntelligenceAgent { this.lastName = this.getContract().getName(); } + if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) + return; + + // Configure parent zone adding this NPC to the + // zone collection + + this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneID); + this.parentZone.zoneMobSet.remove(this); + this.parentZone.zoneMobSet.add(this); + + // Setup location for this Mobile + + this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon); + this.bindLoc = this.parentZone.getLoc().add(this.bindLoc); + this.loc = new Vector3fImmutable(bindLoc); + this.endLoc = new Vector3fImmutable(bindLoc); + + // Handle Mobiles within buildings + + if (this.building != null) { + + // Mobiles inside buildings are offset from it not the zone + + this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon); + this.bindLoc = this.building.getLoc().add(this.bindLoc); + + if (this.contract != null || this.isSiege) + NPCManager.slotCharacterInBuilding(this); + } // Initialize inventory