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 {
rwss.setPlayer(mob); rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss); DispatchMessage.sendToAllInRange(mob, rwss);
} }
mob.updateLocation(); //mob.updateLocation();
if(mob.isMoving() == true){
mob.setLoc(mob.getMovementLoc());
}
if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) { if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
} }
@ -511,7 +514,6 @@ public class MobileFSM {
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
aiAgent.despawn(); aiAgent.despawn();
aiAgent.deathTime = System.currentTimeMillis(); aiAgent.deathTime = System.currentTimeMillis();
return;
} }
//No items in inventory. //No items in inventory.
} else { } else {
@ -520,20 +522,17 @@ public class MobileFSM {
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
aiAgent.despawn(); aiAgent.despawn();
aiAgent.deathTime = System.currentTimeMillis(); aiAgent.deathTime = System.currentTimeMillis();
return;
} }
//Mob never had Loot. //Mob never had Loot.
} else { } else {
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
aiAgent.despawn(); aiAgent.despawn();
aiAgent.deathTime = System.currentTimeMillis(); aiAgent.deathTime = System.currentTimeMillis();
return;
} }
} }
} }
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) { } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
aiAgent.respawn(); aiAgent.respawn();
return;
} }
} }

8
src/engine/objects/Mob.java

@ -1375,7 +1375,8 @@ public class Mob extends AbstractIntelligenceAgent {
this.combat = false; this.combat = false;
this.walkMode = true; this.walkMode = true;
this.combatTarget = null; this.combatTarget = null;
//resync corpses
this.setLoc(this.loc);
this.hasLoot = this.charItemManager.getInventoryCount() > 0; this.hasLoot = this.charItemManager.getInventoryCount() > 0;
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
@ -1384,8 +1385,7 @@ public class Mob extends AbstractIntelligenceAgent {
public void respawn() { public void respawn() {
//Commenting out Mob ID rotation. //Commenting out Mob ID rotation.
this.despawned = false; this.playerAgroMap.clear();
//this.playerAgroMap.clear();
this.setCombatTarget(null); this.setCombatTarget(null);
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
this.stamina.set(this.staminaMax); this.stamina.set(this.staminaMax);
@ -1410,7 +1410,7 @@ public class Mob extends AbstractIntelligenceAgent {
//MovementManager.translocate(this, this.bindLoc, this.region); //MovementManager.translocate(this, this.bindLoc, this.region);
if (!this.isSiege && !this.isPlayerGuard && contract == null) if (!this.isSiege && !this.isPlayerGuard && contract == null)
loadInventory(); loadInventory();
this.despawned = false;
} }
public void despawn() { public void despawn() {

Loading…
Cancel
Save