Movement rework according to latest commits.

This commit is contained in:
MobiusDev
2018-09-10 18:23:09 +00:00
parent 3ae533f32d
commit b5a86698d6
10 changed files with 59 additions and 109 deletions

View File

@ -2910,8 +2910,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
final boolean isFloating = _isFlying || isInsideZone(ZoneId.WATER);
// Stop movement when player has clicked far away and intersected with an obstacle.
if (isPlayer() && !isFloating && !_move.disregardingGeodata && (Math.hypot(dx, dy) > 3000))
if (isPlayer() && !isFloating && !_move.disregardingGeodata //
&& ((Math.hypot(dx, dy) > 3000) // Stop movement when player has clicked far away and intersected with an obstacle.
|| _cursorKeyMovement)) // ...or in case of cursor movement, avoid moving through obstacles.
{
final double angle = Util.convertHeadingToDegree(getHeading());
final double radian = Math.toRadians(angle);
@ -3137,15 +3138,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
final int curY = getY();
final int curZ = getZ();
// In case of cursor movement, avoid moving through obstacles.
if (_cursorKeyMovement)
{
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
x = newDestination.getX();
y = newDestination.getY();
z = newDestination.getZ();
}
// Calculate distance (dx,dy) between current position and destination
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
double dx = (x - curX);