From f9205eb4e2ccac7fe758d681074fbf25b4272a49 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 14 Apr 2023 19:20:12 -0500 Subject: [PATCH] added default behaviourType to "Simple" for mobs. added respawn logic --- src/engine/ai/MobileFSM.java | 12 +++++++++--- src/engine/objects/Mob.java | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index d76c621e..01a1fb89 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -678,7 +678,9 @@ public class MobileFSM { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) { aiAgent.despawn(); //update time of death after mob despawns so respawn time happens after mob despawns. - aiAgent.setDeathTime(System.currentTimeMillis()); + if(aiAgent.deathTime != 0) { + aiAgent.setDeathTime(System.currentTimeMillis()); + } respawn(aiAgent); } @@ -689,7 +691,9 @@ public class MobileFSM { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) { aiAgent.despawn(); //update time of death after mob despawns so respawn time happens after mob despawns. - aiAgent.setDeathTime(System.currentTimeMillis()); + if(aiAgent.deathTime != 0) { + aiAgent.setDeathTime(System.currentTimeMillis()); + } respawn(aiAgent); } //Mob never had Loot. @@ -697,7 +701,9 @@ public class MobileFSM { if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) { aiAgent.despawn(); //update time of death after mob despawns so respawn time happens after mob despawns. - aiAgent.setDeathTime(System.currentTimeMillis()); + if(aiAgent.deathTime != 0) { + aiAgent.setDeathTime(System.currentTimeMillis()); + } respawn(aiAgent); } } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index e5f519d3..83d7bf47 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -293,7 +293,11 @@ public class Mob extends AbstractIntelligenceAgent { this.equipmentSetID = this.contract.getEquipmentSet(); this.nameOverride = rs.getString("mob_name"); - this.BehaviourType = MobileFSM.MobBehaviourType.valueOf(rs.getString("fsm")); + if(rs.getString("fsm").length() > 1) { + this.BehaviourType = MobileFSM.MobBehaviourType.valueOf(rs.getString("fsm")); + } else{ + this.BehaviourType = MobileFSM.MobBehaviourType.Simple; + } } catch (Exception e) { Logger.error(currentID + ""); } @@ -1299,7 +1303,7 @@ public class Mob extends AbstractIntelligenceAgent { this.walkMode = true; this.combatTarget = null; this.isAlive.set(true); - + this.deathTime = 0; this.lastBindLoc = this.bindLoc; this.bindLoc = this.lastBindLoc; this.setLoc(this.lastBindLoc);