From a34386ae519bcaaf2e18ed4ff687e92dbe614f77 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 21 Jul 2023 20:01:39 -0500 Subject: [PATCH] mob resync position on death and while moving --- src/engine/ai/MobileFSM.java | 9 ++++----- src/engine/objects/Mob.java | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index cc1e6fd8..1b25d37d 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -378,7 +378,10 @@ public class MobileFSM { rwss.setPlayer(mob); DispatchMessage.sendToAllInRange(mob, rwss); } - mob.updateLocation(); + //mob.updateLocation(); + if(mob.isMoving() == true){ + mob.setLoc(mob.getMovementLoc()); + } if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) { CheckToSendMobHome(mob); } @@ -511,7 +514,6 @@ public class MobileFSM { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) { aiAgent.despawn(); aiAgent.deathTime = System.currentTimeMillis(); - return; } //No items in inventory. } else { @@ -520,20 +522,17 @@ public class MobileFSM { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) { aiAgent.despawn(); aiAgent.deathTime = System.currentTimeMillis(); - return; } //Mob never had Loot. } else { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) { aiAgent.despawn(); aiAgent.deathTime = System.currentTimeMillis(); - return; } } } } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) { aiAgent.respawn(); - return; } } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 0f94021d..798286fb 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1375,7 +1375,8 @@ public class Mob extends AbstractIntelligenceAgent { this.combat = false; this.walkMode = true; this.combatTarget = null; - + //resync corpses + this.setLoc(this.loc); this.hasLoot = this.charItemManager.getInventoryCount() > 0; } catch (Exception e) { Logger.error(e); @@ -1384,8 +1385,7 @@ public class Mob extends AbstractIntelligenceAgent { public void respawn() { //Commenting out Mob ID rotation. - this.despawned = false; - //this.playerAgroMap.clear(); + this.playerAgroMap.clear(); this.setCombatTarget(null); this.setHealth(this.healthMax); this.stamina.set(this.staminaMax); @@ -1410,7 +1410,7 @@ public class Mob extends AbstractIntelligenceAgent { //MovementManager.translocate(this, this.bindLoc, this.region); if (!this.isSiege && !this.isPlayerGuard && contract == null) loadInventory(); - + this.despawned = false; } public void despawn() {