No need to store location and range for changeIntention check.

This commit is contained in:
MobiusDevelopment 2022-09-06 12:03:23 +00:00
parent fc918dba65
commit 7c86c238b9
24 changed files with 48 additions and 168 deletions

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{

View File

@ -216,16 +216,11 @@ public class AttackableAI extends CreatureAI
{
intention = AI_INTENTION_ACTIVE;
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))
else if ((npc.getSpawn() != null) && !npc.isInsideRadius3D(npc.getSpawn(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE))
{
intention = AI_INTENTION_ACTIVE;
}
}
}
if (intention == AI_INTENTION_IDLE)
{