mob ai work
This commit is contained in:
@@ -78,7 +78,7 @@ public class MobAi2 {
|
|||||||
if (!mob.despawned) {
|
if (!mob.despawned) {
|
||||||
|
|
||||||
//if the inventory is empty, the mob can disappear
|
//if the inventory is empty, the mob can disappear
|
||||||
if(mob.getInventory(true).isEmpty()) {
|
if(mob.getInventory(true).isEmpty() && System.currentTimeMillis() > mob.deathTime + 10000L) {
|
||||||
mob.despawn();
|
mob.despawn();
|
||||||
mob.deathTime = System.currentTimeMillis();
|
mob.deathTime = System.currentTimeMillis();
|
||||||
return;
|
return;
|
||||||
@@ -144,7 +144,10 @@ public class MobAi2 {
|
|||||||
mob.setCombat(true);
|
mob.setCombat(true);
|
||||||
|
|
||||||
if (!CombatUtilities.inRangeToAttack(mob, target)) {
|
if (!CombatUtilities.inRangeToAttack(mob, target)) {
|
||||||
MovementUtilities.aiMove(mob, target.loc, false);
|
if(mob.nextChaseUpdate < System.currentTimeMillis()) {
|
||||||
|
mob.nextChaseUpdate = System.currentTimeMillis() + 1500L;
|
||||||
|
MovementUtilities.aiMove(mob, target.loc, false);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
public int lastPatrolPointIndex = 0;
|
public int lastPatrolPointIndex = 0;
|
||||||
public long stopPatrolTime = 0;
|
public long stopPatrolTime = 0;
|
||||||
public City guardedCity;
|
public City guardedCity;
|
||||||
|
public long nextChaseUpdate = 0;
|
||||||
protected int dbID; //the database ID
|
protected int dbID; //the database ID
|
||||||
protected int loadID;
|
protected int loadID;
|
||||||
protected float spawnRadius;
|
protected float spawnRadius;
|
||||||
|
|||||||
Reference in New Issue
Block a user