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() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -694,11 +694,10 @@ abstract class AbstractAI implements Ctrl
{ {
if (_clientMoving) if (_clientMoving)
{ {
final Creature follow = getFollowTarget(); if ((_clientMovingToPawnOffset != 0) && isFollowing())
if ((_clientMovingToPawnOffset != 0) && (follow != null))
{ {
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, follow, _clientMovingToPawnOffset)); player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset));
} }
else else
{ {
@ -708,6 +707,11 @@ abstract class AbstractAI implements Ctrl
} }
} }
public boolean isFollowing()
{
return (_followTarget != null) && ((_intention == AI_INTENTION_FOLLOW) || CreatureFollowTaskManager.getInstance().isFollowing(_actor));
}
/** /**
* Create and Launch an AI Follow Task to execute every 1s. * Create and Launch an AI Follow Task to execute every 1s.
* @param target The Creature to follow * @param target The Creature to follow

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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -694,11 +694,10 @@ abstract class AbstractAI implements Ctrl
{ {
if (_clientMoving) if (_clientMoving)
{ {
final Creature follow = getFollowTarget(); if ((_clientMovingToPawnOffset != 0) && isFollowing())
if ((_clientMovingToPawnOffset != 0) && (follow != null))
{ {
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, follow, _clientMovingToPawnOffset)); player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset));
} }
else else
{ {
@ -708,6 +707,11 @@ abstract class AbstractAI implements Ctrl
} }
} }
public boolean isFollowing()
{
return (_followTarget != null) && ((_intention == AI_INTENTION_FOLLOW) || CreatureFollowTaskManager.getInstance().isFollowing(_actor));
}
/** /**
* Create and Launch an AI Follow Task to execute every 1s. * Create and Launch an AI Follow Task to execute every 1s.
* @param target The Creature to follow * @param target The Creature to follow

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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -744,7 +744,7 @@ public abstract class AbstractAI implements Ctrl
{ {
if (_actor.isVisibleFor(player) && _clientMoving) if (_actor.isVisibleFor(player) && _clientMoving)
{ {
if ((_clientMovingToPawnOffset != 0) && (_followTarget != null)) if ((_clientMovingToPawnOffset != 0) && isFollowing())
{ {
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset)); player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset));
@ -757,6 +757,11 @@ public abstract class AbstractAI implements Ctrl
} }
} }
public boolean isFollowing()
{
return (_followTarget != null) && ((_intention == AI_INTENTION_FOLLOW) || CreatureFollowTaskManager.getInstance().isFollowing(_actor));
}
/** /**
* Create and Launch an AI Follow Task to execute every 1s. * Create and Launch an AI Follow Task to execute every 1s.
* @param target The Creature to follow * @param target The Creature to follow

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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -744,7 +744,7 @@ public abstract class AbstractAI implements Ctrl
{ {
if (_actor.isVisibleFor(player) && _clientMoving) if (_actor.isVisibleFor(player) && _clientMoving)
{ {
if ((_clientMovingToPawnOffset != 0) && (_followTarget != null)) if ((_clientMovingToPawnOffset != 0) && isFollowing())
{ {
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset)); player.sendPacket(new MoveToPawn(_actor, _followTarget, _clientMovingToPawnOffset));
@ -757,6 +757,11 @@ public abstract class AbstractAI implements Ctrl
} }
} }
public boolean isFollowing()
{
return (_followTarget != null) && ((_intention == AI_INTENTION_FOLLOW) || CreatureFollowTaskManager.getInstance().isFollowing(_actor));
}
/** /**
* Create and Launch an AI Follow Task to execute every 1s. * Create and Launch an AI Follow Task to execute every 1s.
* @param target The Creature to follow * @param target The Creature to follow

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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)

View File

@ -692,7 +692,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing() 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) public void addNormalFollow(Creature creature, int range)
{ {
follow(creature, range);
NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range); NORMAL_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void addAttackFollow(Creature creature, int range) public void addAttackFollow(Creature creature, int range)
{ {
follow(creature, range);
ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range); ATTACK_FOLLOW_CREATURES.putIfAbsent(creature, range);
follow(creature, range);
} }
public void remove(Creature creature) public void remove(Creature creature)