Smoother movement when exiting vehicle.

This commit is contained in:
MobiusDev
2018-01-23 09:36:38 +00:00
parent 48bd6b84c8
commit ad7fef7d49
6 changed files with 72 additions and 54 deletions

View File

@@ -3294,15 +3294,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle)

View File

@@ -3294,15 +3294,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle)

View File

@@ -3294,15 +3294,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle)

View File

@@ -3294,15 +3294,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle)

View File

@@ -4398,15 +4398,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isAfraid() && !isInVehicle) if (((originalDistance - distance) > 30) && !isAfraid() && !isInVehicle)

View File

@@ -3294,15 +3294,18 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
// location different if destination wasn't reached (or just z coord is different) if (!isInVehicle)
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld()); {
x = destiny.getX(); // location different if destination wasn't reached (or just z coord is different)
y = destiny.getY(); final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
z = destiny.getZ(); x = destiny.getX();
dx = x - curX; y = destiny.getY();
dy = y - curY; z = destiny.getZ();
dz = z - curZ; dx = x - curX;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); dy = y - curY;
dz = z - curZ;
distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy);
}
// Pathfinding checks. // Pathfinding checks.
if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) if (((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle)