Browse Source

bug: Mobs that aren't too far from home but lose their targets sometimes don't return back

tags/v0.12.0
Shaun 1 year ago
parent
commit
008cda5385
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/server/components/mob.js

+ 2
- 2
src/server/components/mob.js View File

@@ -144,9 +144,9 @@ module.exports = {

//Are we too far from home?
let distanceFromHome = Math.max(abs(this.originX - obj.x), abs(this.originY - obj.y));
if (distanceFromHome > this.maxChaseDistance)
if (distanceFromHome > this.maxChaseDistance || (distanceFromHome > this.walkDistance && !target))
this.goHome = true;
else if ((target) && (target !== obj) && ((!obj.follower) || (obj.follower.master !== target))) {
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;


Loading…
Cancel
Save