Reverted follow while target is running changes.
Contributed by Trance.
This commit is contained in:
@@ -474,7 +474,7 @@ abstract class AbstractAI implements Ctrl
|
||||
}
|
||||
|
||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||
_accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
|
||||
_accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
|
||||
|
||||
// May result to make monsters stop moving.
|
||||
// if (!_actor.isMoving())
|
||||
|
||||
@@ -1028,7 +1028,7 @@ public class CreatureAI extends AbstractAI
|
||||
return true;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -4056,15 +4056,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
|
||||
/**
|
||||
* Accessor to Creature moveToLocation() method with an interaction area.
|
||||
* @param target The target to follow, if any.
|
||||
* @param x the x
|
||||
* @param y the y
|
||||
* @param z the z
|
||||
* @param offset the offset
|
||||
*/
|
||||
public void moveTo(WorldObject target, int x, int y, int z, int offset)
|
||||
public void moveTo(int x, int y, int z, int offset)
|
||||
{
|
||||
moveToLocation(target, x, y, z, offset);
|
||||
moveToLocation(x, y, z, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4142,7 +4141,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
|
||||
public int _moveStartTime;
|
||||
public int _moveTimestamp;
|
||||
public WorldObject _target;
|
||||
public int _xDestination;
|
||||
public int _yDestination;
|
||||
public int _zDestination;
|
||||
@@ -4665,12 +4663,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getX();
|
||||
}
|
||||
|
||||
return m._xDestination;
|
||||
}
|
||||
return getX();
|
||||
@@ -4685,12 +4677,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getY();
|
||||
}
|
||||
|
||||
return m._yDestination;
|
||||
}
|
||||
return getY();
|
||||
@@ -4705,12 +4691,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
final MoveData m = _move;
|
||||
if (m != null)
|
||||
{
|
||||
final WorldObject target = m._target;
|
||||
if (target != null)
|
||||
{
|
||||
return target.getZ();
|
||||
}
|
||||
|
||||
return m._zDestination;
|
||||
}
|
||||
return getZ();
|
||||
@@ -4916,28 +4896,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
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;
|
||||
double distFraction;
|
||||
// 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;
|
||||
}
|
||||
double dx = m._xDestination - m._xAccurate;
|
||||
double dy = m._yDestination - m._yAccurate;
|
||||
double dz = m._zDestination - zPrev; // Z coordinate will follow client values
|
||||
|
||||
// Z coordinate will follow client values
|
||||
dz = m._zDestination - zPrev;
|
||||
float speed;
|
||||
if (this instanceof BoatInstance)
|
||||
{
|
||||
@@ -4979,6 +4944,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
}
|
||||
}
|
||||
|
||||
double distFraction;
|
||||
final double distPassed = (speed * (gameTicks - m._moveTimestamp)) / GameTimeTaskManager.TICKS_PER_SECOND;
|
||||
if ((((dx * dx) + (dy * dy)) < 10000) && ((dz * dz) > 2500)) // close enough, allows error between client and server geodata if it cannot be avoided
|
||||
{
|
||||
@@ -4992,14 +4958,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
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);
|
||||
|
||||
if (isBoat())
|
||||
{
|
||||
@@ -5182,11 +5141,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
return _target;
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -5207,13 +5161,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <b><u>Example of use</u>:</b><br>
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li><br>
|
||||
* @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
|
||||
*/
|
||||
protected void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue)
|
||||
protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
|
||||
{
|
||||
// Get the Move Speed of the Creature
|
||||
final float speed = getStat().getMoveSpeed();
|
||||
@@ -5466,7 +5419,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
// 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
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DoorInstance extends Creature
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTo(WorldObject target, int x, int y, int z, int offset)
|
||||
public void moveTo(int x, int y, int z, int offset)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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