Fixed moveToPawn offset stackoverflow.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment 2019-10-24 21:23:46 +00:00
parent 072ddd657c
commit a29d7b915c
18 changed files with 72 additions and 73 deletions

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -1006,14 +1006,13 @@ public class CreatureAI extends AbstractAI
return false; return false;
} }
offset += _actor.getTemplate().collisionRadius; int offsetWithCollision = offset + _actor.getTemplate().collisionRadius;
if (target instanceof Creature) if (target instanceof Creature)
{ {
offset += ((Creature) target).getTemplate().collisionRadius; offsetWithCollision += ((Creature) target).getTemplate().collisionRadius;
} }
if (!_actor.isInsideRadius(target, offset, false, false)) if (!_actor.isInsideRadius(target, offsetWithCollision, false, false))
{ {
final Creature follow = getFollowTarget(); final Creature follow = getFollowTarget();
@ -1043,7 +1042,7 @@ public class CreatureAI extends AbstractAI
return true; return true;
} }
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius(target, offset + 100, false, false)) if (!_actor.isInsideRadius(target, offsetWithCollision + 100, false, false))
{ {
return true; return true;
} }

View File

@ -991,19 +991,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (getFollowTarget() != null) if (getFollowTarget() != null)
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -991,19 +991,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (getFollowTarget() != null) if (getFollowTarget() != null)
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }

View File

@ -942,19 +942,19 @@ public class CreatureAI extends AbstractAI
return false; // skill radius -1 return false; // skill radius -1
} }
offset += _actor.getTemplate().getCollisionRadius(); int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
if (target.isCreature()) if (target.isCreature())
{ {
offset += ((Creature) target).getTemplate().getCollisionRadius(); offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
} }
if (!_actor.isInsideRadius2D(target, offset)) if (!_actor.isInsideRadius2D(target, offsetWithCollision))
{ {
// Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
if (isFollowing()) if (isFollowing())
{ {
// allow larger hit range when the target is moving (check is run only once per second) // allow larger hit range when the target is moving (check is run only once per second)
if (!_actor.isInsideRadius2D(target, offset + 100)) if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
{ {
return true; return true;
} }