In case of cursor movement, avoid moving through obstacles.
This commit is contained in:
@@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||||
|
|
||||||
// Z coordinate will follow geodata or client values
|
// Z coordinate will follow geodata or client values
|
||||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
|
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||||
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||||
{
|
{
|
||||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||||
dz = m._zDestination - geoHeight;
|
dz = m._zDestination - geoHeight;
|
||||||
@@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
{
|
{
|
||||||
// Delete movement data of the L2Character
|
// Delete movement data of the L2Character
|
||||||
_move = null;
|
_move = null;
|
||||||
|
_cursorKeyMovement = false;
|
||||||
|
|
||||||
// All data are contained in a Location object
|
// All data are contained in a Location object
|
||||||
if (loc != null)
|
if (loc != null)
|
||||||
@@ -3146,6 +3146,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
final int curY = getY();
|
final int curY = getY();
|
||||||
final int curZ = getZ();
|
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
|
// Calculate distance (dx,dy) between current position and destination
|
||||||
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
|
@@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||||
|
|
||||||
// Z coordinate will follow geodata or client values
|
// Z coordinate will follow geodata or client values
|
||||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
|
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||||
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||||
{
|
{
|
||||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||||
dz = m._zDestination - geoHeight;
|
dz = m._zDestination - geoHeight;
|
||||||
@@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
{
|
{
|
||||||
// Delete movement data of the L2Character
|
// Delete movement data of the L2Character
|
||||||
_move = null;
|
_move = null;
|
||||||
|
_cursorKeyMovement = false;
|
||||||
|
|
||||||
// All data are contained in a Location object
|
// All data are contained in a Location object
|
||||||
if (loc != null)
|
if (loc != null)
|
||||||
@@ -3146,6 +3146,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
final int curY = getY();
|
final int curY = getY();
|
||||||
final int curZ = getZ();
|
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
|
// Calculate distance (dx,dy) between current position and destination
|
||||||
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
|
@@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||||
|
|
||||||
// Z coordinate will follow geodata or client values
|
// Z coordinate will follow geodata or client values
|
||||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
|
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||||
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||||
{
|
{
|
||||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||||
dz = m._zDestination - geoHeight;
|
dz = m._zDestination - geoHeight;
|
||||||
@@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
{
|
{
|
||||||
// Delete movement data of the L2Character
|
// Delete movement data of the L2Character
|
||||||
_move = null;
|
_move = null;
|
||||||
|
_cursorKeyMovement = false;
|
||||||
|
|
||||||
// All data are contained in a Location object
|
// All data are contained in a Location object
|
||||||
if (loc != null)
|
if (loc != null)
|
||||||
@@ -3146,6 +3146,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
final int curY = getY();
|
final int curY = getY();
|
||||||
final int curZ = getZ();
|
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
|
// Calculate distance (dx,dy) between current position and destination
|
||||||
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
|
@@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||||
|
|
||||||
// Z coordinate will follow geodata or client values
|
// Z coordinate will follow geodata or client values
|
||||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
|
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||||
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||||
{
|
{
|
||||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||||
dz = m._zDestination - geoHeight;
|
dz = m._zDestination - geoHeight;
|
||||||
@@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
{
|
{
|
||||||
// Delete movement data of the L2Character
|
// Delete movement data of the L2Character
|
||||||
_move = null;
|
_move = null;
|
||||||
|
_cursorKeyMovement = false;
|
||||||
|
|
||||||
// All data are contained in a Location object
|
// All data are contained in a Location object
|
||||||
if (loc != null)
|
if (loc != null)
|
||||||
@@ -3146,6 +3146,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
final int curY = getY();
|
final int curY = getY();
|
||||||
final int curZ = getZ();
|
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
|
// Calculate distance (dx,dy) between current position and destination
|
||||||
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
|
@@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||||
|
|
||||||
// Z coordinate will follow geodata or client values
|
// Z coordinate will follow geodata or client values
|
||||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
|
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||||
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||||
{
|
{
|
||||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||||
dz = m._zDestination - geoHeight;
|
dz = m._zDestination - geoHeight;
|
||||||
@@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
{
|
{
|
||||||
// Delete movement data of the L2Character
|
// Delete movement data of the L2Character
|
||||||
_move = null;
|
_move = null;
|
||||||
|
_cursorKeyMovement = false;
|
||||||
|
|
||||||
// All data are contained in a Location object
|
// All data are contained in a Location object
|
||||||
if (loc != null)
|
if (loc != null)
|
||||||
@@ -3146,6 +3146,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
final int curY = getY();
|
final int curY = getY();
|
||||||
final int curZ = getZ();
|
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
|
// Calculate distance (dx,dy) between current position and destination
|
||||||
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
// TODO: improve Z axis move/follow support when dx,dy are small compared to dz
|
||||||
double dx = (x - curX);
|
double dx = (x - curX);
|
||||||
|
Reference in New Issue
Block a user