Fixing world movement2

This commit is contained in:
dingo
2026-02-15 10:31:11 -05:00
parent da271af0d7
commit c6beed0a1f
+5 -2
View File
@@ -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;