From 6008c17a0bd5daf163a831d431da62d25480a7dd Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 15 Feb 2026 12:03:51 -0500 Subject: [PATCH] Working on world coords --- Game/World/WorldHandler.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Game/World/WorldHandler.cs b/Game/World/WorldHandler.cs index 5a91e59..7301562 100644 --- a/Game/World/WorldHandler.cs +++ b/Game/World/WorldHandler.cs @@ -213,13 +213,18 @@ public sealed class WorldHandler : IClientMessageHandler var hasMovement = MathF.Abs(dx) > 0.001f || MathF.Abs(dy) > 0.001f; var now = DateTime.UtcNow; - if (req.HasTargetPosition) + if (req.UseTargetPosition) { s.HasPendingTarget = true; s.PendingTargetX = req.TargetX; s.PendingTargetY = req.TargetY; s.LastNonNeutralInputAt = now; } + else if (hasMovement) + { + // Directional input takes precedence over any previously latched target. + s.HasPendingTarget = false; + } // Store latest input; movement/collision is applied once per world tick to avoid input backlog. // Keep the last non-neutral direction briefly to avoid neutral packet jitter canceling held input. @@ -686,6 +691,7 @@ public sealed class WorldHandler : IClientMessageHandler // Compatibility: clients that send absolute target x/y (dungeon-style). // Prefer absolute target when directional input is missing OR effectively zero. var hasAbsTarget = false; + var useAbsTarget = false; var absTargetX = 0f; var absTargetY = 0f; if (hasRawX && hasRawY && (!IsDirectionalValue(rawX) || !IsDirectionalValue(rawY))) @@ -700,6 +706,7 @@ public sealed class WorldHandler : IClientMessageHandler (MathF.Abs(moveX) <= 0.01f && MathF.Abs(moveY) <= 0.01f); if (directionalIsNeutral && len > 0.5f) { + useAbsTarget = true; moveX = dx / len; moveY = dy / len; hasMoveX = true; @@ -727,6 +734,7 @@ public sealed class WorldHandler : IClientMessageHandler IsMovingProvided = hasIsMoving, IsMoving = isMoving, HasTargetPosition = hasAbsTarget, + UseTargetPosition = useAbsTarget, TargetX = absTargetX, TargetY = absTargetY }; @@ -920,6 +928,7 @@ public sealed class WorldHandler : IClientMessageHandler public bool IsMovingProvided { get; set; } public bool IsMoving { get; set; } public bool HasTargetPosition { get; set; } + public bool UseTargetPosition { get; set; } public float TargetX { get; set; } public float TargetY { get; set; } }