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