forked from MagicBane/Server
added default behaviourType to "Simple" for mobs. added respawn logic
This commit is contained in:
@@ -678,7 +678,9 @@ 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();
|
||||||
//update time of death after mob despawns so respawn time happens after mob despawns.
|
//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);
|
respawn(aiAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,7 +691,9 @@ 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();
|
||||||
//update time of death after mob despawns so respawn time happens after mob despawns.
|
//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);
|
respawn(aiAgent);
|
||||||
}
|
}
|
||||||
//Mob never had Loot.
|
//Mob never had Loot.
|
||||||
@@ -697,7 +701,9 @@ public class MobileFSM {
|
|||||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||||
aiAgent.despawn();
|
aiAgent.despawn();
|
||||||
//update time of death after mob despawns so respawn time happens after mob despawns.
|
//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);
|
respawn(aiAgent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,7 +293,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.equipmentSetID = this.contract.getEquipmentSet();
|
this.equipmentSetID = this.contract.getEquipmentSet();
|
||||||
|
|
||||||
this.nameOverride = rs.getString("mob_name");
|
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) {
|
} catch (Exception e) {
|
||||||
Logger.error(currentID + "");
|
Logger.error(currentID + "");
|
||||||
}
|
}
|
||||||
@@ -1299,7 +1303,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.walkMode = true;
|
this.walkMode = true;
|
||||||
this.combatTarget = null;
|
this.combatTarget = null;
|
||||||
this.isAlive.set(true);
|
this.isAlive.set(true);
|
||||||
|
this.deathTime = 0;
|
||||||
this.lastBindLoc = this.bindLoc;
|
this.lastBindLoc = this.bindLoc;
|
||||||
this.bindLoc = this.lastBindLoc;
|
this.bindLoc = this.lastBindLoc;
|
||||||
this.setLoc(this.lastBindLoc);
|
this.setLoc(this.lastBindLoc);
|
||||||
|
|||||||
Reference in New Issue
Block a user