Reverted follow while target is running changes.
Contributed by Trance.
This commit is contained in:
@@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
}
|
||||
case AI_INTENTION_CAST:
|
||||
{
|
||||
onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]);
|
||||
onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]);
|
||||
break;
|
||||
}
|
||||
case AI_INTENTION_MOVE_TO:
|
||||
@@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
}
|
||||
|
||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
|
||||
_actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
|
||||
|
||||
// May result to make monsters stop moving.
|
||||
// if (!_actor.isMoving())
|
||||
|
@@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI
|
||||
if (isFollowing())
|
||||
{
|
||||
// allow larger hit range when the target is moving (check is run only once per second)
|
||||
if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
|
||||
if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
// to recalculate position
|
||||
public int _moveStartTime;
|
||||
public int _moveTimestamp; // last update
|
||||
public WorldObject _target;
|
||||
public int _xDestination;
|
||||
public int _yDestination;
|
||||
public int _zDestination;
|
||||
@@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getX();
|
||||
}
|
||||
|
||||
return m._xDestination;
|
||||
}
|
||||
return getX();
|
||||
@@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getY();
|
||||
}
|
||||
|
||||
return m._yDestination;
|
||||
}
|
||||
return getY();
|
||||
@@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getZ();
|
||||
}
|
||||
|
||||
return m._zDestination;
|
||||
}
|
||||
return getZ();
|
||||
@@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
return false;
|
||||
}
|
||||
|
||||
final WorldObject target = m._target;
|
||||
final int xPrev = getX();
|
||||
final int yPrev = getY();
|
||||
final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
|
||||
double dx;
|
||||
double dy;
|
||||
double dz;
|
||||
// Save temporary values to avoid rounding errors.
|
||||
if (target != null)
|
||||
{
|
||||
dx = target.getX() - m._xAccurate;
|
||||
dy = target.getY() - m._yAccurate;
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = m._xDestination - m._xAccurate;
|
||||
dy = m._yDestination - m._yAccurate;
|
||||
}
|
||||
|
||||
// Z coordinate will follow client values
|
||||
dz = m._zDestination - zPrev;
|
||||
double dx = m._xDestination - m._xAccurate;
|
||||
double dy = m._yDestination - m._yAccurate;
|
||||
double dz = m._zDestination - zPrev; // Z coordinate will follow client values
|
||||
if (isPlayer() && !_isFlying)
|
||||
{
|
||||
final double distance = Math.hypot(dx, dy);
|
||||
@@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
if (distFraction > 1)
|
||||
{
|
||||
// Set the position of the Creature to the destination
|
||||
if (target != null)
|
||||
{
|
||||
super.setXYZ(target.getX(), target.getY(), target.getZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
super.setXYZ(m._xDestination, m._yDestination, m._zDestination);
|
||||
}
|
||||
super.setXYZ(m._xDestination, m._yDestination, m._zDestination);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
// called from AIAccessor only
|
||||
|
||||
public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
|
||||
{
|
||||
moveToLocation(null, xValue, yValue, zValue, offsetValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).<br>
|
||||
* <br>
|
||||
@@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @param target The target to follow, if any.
|
||||
* @param xValue The X position of the destination
|
||||
* @param yValue The Y position of the destination
|
||||
* @param zValue The Y position of the destination
|
||||
* @param offsetValue The size of the interaction area of the Creature targeted
|
||||
*/
|
||||
public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue)
|
||||
public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
|
||||
{
|
||||
// Get the Move Speed of the Creature
|
||||
final double speed = _stat.getMoveSpeed();
|
||||
@@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
// Calculate the number of ticks between the current position and the destination
|
||||
// One tick added for rounding reasons
|
||||
final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed);
|
||||
m._target = target;
|
||||
m._xDestination = x;
|
||||
m._yDestination = y;
|
||||
m._zDestination = z; // this is what was requested from client
|
||||
|
@@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@@ -107,8 +106,7 @@ public class CreatureFollowTaskManager
|
||||
}
|
||||
|
||||
final int followRange = range == -1 ? Rnd.get(50, 100) : range;
|
||||
final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius();
|
||||
if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision))
|
||||
if (!creature.isInsideRadius3D(followTarget, followRange))
|
||||
{
|
||||
if (!creature.isInsideRadius3D(followTarget, 3000))
|
||||
{
|
||||
@@ -122,10 +120,6 @@ public class CreatureFollowTaskManager
|
||||
}
|
||||
ai.moveToPawn(followTarget, followRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai.notifyEvent(CtrlEvent.EVT_ARRIVED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user