Fixing world movement2
This commit is contained in:
@@ -627,12 +627,15 @@ public sealed class WorldHandler : IClientMessageHandler
|
||||
}
|
||||
|
||||
// Compatibility: clients that send absolute target x/y (dungeon-style).
|
||||
if (!hasMoveX && !hasMoveY && hasRawX && hasRawY && (!IsDirectionalValue(rawX) || !IsDirectionalValue(rawY)))
|
||||
// Prefer absolute target when directional input is missing OR effectively zero.
|
||||
if (hasRawX && hasRawY && (!IsDirectionalValue(rawX) || !IsDirectionalValue(rawY)))
|
||||
{
|
||||
var dx = rawX - currentX;
|
||||
var dy = rawY - currentY;
|
||||
var len = MathF.Sqrt((dx * dx) + (dy * dy));
|
||||
if (len > 0.001f)
|
||||
var directionalIsNeutral = (!hasMoveX && !hasMoveY) ||
|
||||
(MathF.Abs(moveX) <= 0.01f && MathF.Abs(moveY) <= 0.01f);
|
||||
if (directionalIsNeutral && len > 0.5f)
|
||||
{
|
||||
moveX = dx / len;
|
||||
moveY = dy / len;
|
||||
|
||||
Reference in New Issue
Block a user