Browse Source

mob resync position on death and while moving

master
FatBoy-DOTC 1 year ago
parent
commit
a34386ae51
  1. 9
      src/engine/ai/MobileFSM.java
  2. 8
      src/engine/objects/Mob.java

9
src/engine/ai/MobileFSM.java

@ -378,7 +378,10 @@ public class MobileFSM { @@ -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 { @@ -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 { @@ -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;
}
}

8
src/engine/objects/Mob.java

@ -1375,7 +1375,8 @@ public class Mob extends AbstractIntelligenceAgent { @@ -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 { @@ -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 { @@ -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() {

Loading…
Cancel
Save