In case of cursor movement, avoid moving through obstacles.

This commit is contained in:
MobiusDev 2017-12-20 23:58:28 +00:00
parent 1a23dd2da8
commit 661ac22cae
5 changed files with 60 additions and 15 deletions

View File

@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// 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
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
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))
{
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
dz = m._zDestination - geoHeight;
@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
// Delete movement data of the L2Character
_move = null;
_cursorKeyMovement = false;
// All data are contained in a Location object
if (loc != null)
@ -3146,6 +3146,15 @@ 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);

View File

@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// 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
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
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))
{
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
dz = m._zDestination - geoHeight;
@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
// Delete movement data of the L2Character
_move = null;
_cursorKeyMovement = false;
// All data are contained in a Location object
if (loc != null)
@ -3146,6 +3146,15 @@ 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);

View File

@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// 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
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
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))
{
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
dz = m._zDestination - geoHeight;
@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
// Delete movement data of the L2Character
_move = null;
_cursorKeyMovement = false;
// All data are contained in a Location object
if (loc != null)
@ -3146,6 +3146,15 @@ 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);

View File

@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// 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
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
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))
{
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
dz = m._zDestination - geoHeight;
@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
// Delete movement data of the L2Character
_move = null;
_cursorKeyMovement = false;
// All data are contained in a Location object
if (loc != null)
@ -3146,6 +3146,15 @@ 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);

View File

@ -2914,10 +2914,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// 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
) && GeoEngine.getInstance().hasGeo(xPrev, yPrev))
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))
{
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
dz = m._zDestination - geoHeight;
@ -3026,6 +3025,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
// Delete movement data of the L2Character
_move = null;
_cursorKeyMovement = false;
// All data are contained in a Location object
if (loc != null)
@ -3146,6 +3146,15 @@ 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);