Fixed monster random movement.
This commit is contained in:
@ -69,6 +69,7 @@ public class AttackableAI extends CreatureAI
|
||||
|
||||
private static final int RANDOM_WALK_RATE = 30; // confirmed
|
||||
private static final int MAX_ATTACK_TIMEOUT = 1200; // int ticks, i.e. 2min
|
||||
|
||||
/**
|
||||
* The delay after which the attacked is stopped.
|
||||
*/
|
||||
@ -478,7 +479,7 @@ public class AttackableAI extends CreatureAI
|
||||
}
|
||||
|
||||
// Order this attackable to return to its spawn because there's no target to attack
|
||||
if (!npc.isWalker() && ((getTarget() == null) || getTarget().isInvisible() || (getTarget().isPlayer() && !Config.ATTACKABLES_CAMP_PLAYER_CORPSES && getTarget().getActingPlayer().isAlikeDead())))
|
||||
if (!npc.isWalker() && (npc.getSpawn() != null) && (npc.calculateDistance2D(npc.getSpawn()) > Config.MAX_DRIFT_RANGE) && ((getTarget() == null) || getTarget().isInvisible() || (getTarget().isPlayer() && !Config.ATTACKABLES_CAMP_PLAYER_CORPSES && getTarget().getActingPlayer().isAlikeDead())))
|
||||
{
|
||||
npc.setWalking();
|
||||
npc.returnHome();
|
||||
|
Reference in New Issue
Block a user