Fixed stackoverflow errors from movement.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2020-06-16 16:08:26 +00:00
parent 67fffe36d7
commit 8bdf70c0e1
38 changed files with 174 additions and 61 deletions

View File

@@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing()
{
return (_target != null) && _target.isCreature() && (_intention == AI_INTENTION_FOLLOW);
return (_target != null) && _target.isCreature() && ((_intention == AI_INTENTION_FOLLOW) || CreatureFollowTaskManager.getInstance().isFollowing(_actor));
}
/**

View File

@@ -126,16 +126,21 @@ public class CreatureFollowTaskManager
}
}
public boolean isFollowing(Creature creature)
{
return NORMAL_FOLLOW_CREATURES.containsKey(creature) || ATTACK_FOLLOW_CREATURES.containsKey(creature);
}
public void addNormalFollow(Creature creature, int range)
{
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
}
public void addAttackFollow(Creature creature, int range)
{
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
}
public void remove(Creature creature)