|
|
@@ -138,7 +138,7 @@ module.exports = { |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.goHome) { |
|
|
|
//Are we too far from home? |
|
|
|
//Are we chasing a target too far from home? |
|
|
|
if (!obj.follower && target) { |
|
|
|
if (!this.canChase(target)) { |
|
|
|
obj.clearQueue(); |
|
|
@@ -147,7 +147,11 @@ module.exports = { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((target) && (target !== obj) && ((!obj.follower) || (obj.follower.master !== target))) { |
|
|
|
//Are we too far from home? |
|
|
|
let distanceFromHome = Math.max(abs(this.originX - obj.x), abs(this.originY - obj.y)); |
|
|
|
if (distanceFromHome > this.maxChaseDistance) |
|
|
|
this.goHome = true; |
|
|
|
else if ((target) && (target !== obj) && ((!obj.follower) || (obj.follower.master !== target))) { |
|
|
|
//If we just started attacking, patrols need to know where home is |
|
|
|
if (!this.target && this.patrol) { |
|
|
|
this.originX = obj.x; |
|
|
|