Player moving on ledges check replaced by combined Water-Castle check.

This commit is contained in:
MobiusDevelopment
2023-02-07 01:26:07 +02:00
parent 2a8040a745
commit 4c1957ff3d
31 changed files with 144 additions and 555 deletions

View File

@ -3276,25 +3276,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
}
}
// Prevent player moving on ledges.
if ((dz > 180) && (distance < 300))
{
_move.onGeodataPathIndex = -1;
if (hasAI() && getAI().isFollowing())
{
getAI().stopFollow();
}
stopMove(null);
return false;
}
}
}
final boolean isFloating = _isFlying || isInsideZone(ZoneId.WATER);
double delta = (dx * dx) + (dy * dy);
if ((delta < 10000) && ((dz * dz) > 2500) // close enough, allows error between client and server geodata if it cannot be avoided
&& !isFloating)
final boolean isFloating = _isFlying || (isInsideZone(ZoneId.WATER) && !isInsideZone(ZoneId.CASTLE));
if (!isFloating && (delta < 10000) && ((dz * dz) > 2500)) // Close enough, allows error between client and server geodata if it cannot be avoided.
{
delta = Math.sqrt(delta);
}
@ -3321,7 +3308,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
m._yAccurate += dy * distFraction;
// Set the position of the Creature to estimated after parcial move
super.setXYZ((int) (m._xAccurate), (int) (m._yAccurate), zPrev + (int) ((dz * distFraction) + 0.5));
super.setXYZ((int) m._xAccurate, (int) m._yAccurate, zPrev + (int) ((dz * distFraction) + 0.5));
}
revalidateZone(false);
@ -3523,7 +3510,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
// Make water move short and use no geodata checks for swimming chars distance in a click can easily be over 3000.
final boolean isInWater = isInsideZone(ZoneId.WATER);
final boolean isInWater = isInsideZone(ZoneId.WATER) && !isInsideZone(ZoneId.CASTLE);
if (isInWater && (distance > 700))
{
final double divider = 700 / distance;