Ignore no path found issues.

Thanks to Trance.
This commit is contained in:
MobiusDevelopment
2021-03-01 03:31:23 +00:00
parent 034a771eb5
commit 39ef320fab
88 changed files with 1386 additions and 990 deletions

View File

@@ -177,6 +177,17 @@ public class GeoEngine
return region.hasGeo();
}
/**
* Checks the specified position for available geodata.
* @param x the world x
* @param y the world y
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
*/
public boolean hasGeo(int x, int y)
{
return hasGeoPos(getGeoX(x), getGeoY(y));
}
/**
* @param geoX
* @param geoY
@@ -271,6 +282,42 @@ public class GeoEngine
return region.getNextHigherZ(geoX, geoY, worldZ);
}
/**
* Gets the Z height.
* @param x the world x
* @param y the world y
* @param z the world z
* @return the nearest Z height
*/
public int getHeight(int x, int y, int z)
{
return getNearestZ(getGeoX(x), getGeoY(y), z);
}
/**
* Gets the next lower Z height.
* @param x the world x
* @param y the world y
* @param z the world z
* @return the nearest Z height
*/
public int getLowerHeight(int x, int y, int z)
{
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
}
/**
* Gets the next higher Z height.
* @param x the world x
* @param y the world y
* @param z the world z
* @return the nearest Z height
*/
public int getHigherHeight(int x, int y, int z)
{
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
}
/**
* @param worldX
* @return the geo X
@@ -325,18 +372,6 @@ public class GeoEngine
return (geoZ * 16) + WORLD_MIN_Z + 8;
}
/**
* Gets the Z height.
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
* @return the nearest Z height
*/
public int getHeight(int x, int y, int z)
{
return getNearestZ(getGeoX(x), getGeoY(y), z);
}
/**
* Can see target. Doors as target always return true. Checks doors between.
* @param cha the character
@@ -699,17 +734,6 @@ public class GeoEngine
return true;
}
/**
* Checks the specified position for available geodata.
* @param x the X coordinate
* @param y the Y coordinate
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
*/
public boolean hasGeo(int x, int y)
{
return hasGeoPos(getGeoX(x), getGeoY(y));
}
public static GeoEngine getInstance()
{
return SingletonHolder.INSTANCE;

View File

@@ -5516,6 +5516,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
x = destiny.getX();
y = destiny.getY();
z = destiny.getZ();
dx = x - curX;
dy = y - curY;
dz = z - curZ;
@@ -5529,13 +5530,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
{
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
{
return;
}
m.disregardingGeodata = true;
// Mobius: Verify destination. Prevents wall collision issues.
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
x = newDestination.getX();
y = newDestination.getY();
z = newDestination.getZ();
x = originalX;
y = originalY;
z = originalZ;
distance = originalDistance;
}
else
{

View File

@@ -15483,7 +15483,7 @@ public class PlayerInstance extends Playable
{
if (Config.CORRECT_PLAYER_Z)
{
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
if (getZ() < nearestZ)
{
teleToLocation(new Location(getX(), getY(), nearestZ), false);