From b4a09ad479ef6a61f12cf82853fa69e7efaf073b Mon Sep 17 00:00:00 2001 From: flan Date: Sat, 2 Aug 2025 00:57:34 +0200 Subject: [PATCH] Don't set facing on initial position update Prevents clients from having their facing set to east in case they don't send an `f` packet after connecting. The cause was the `x > c.x` condition always being hit (any valid X coordinate > -1). Prior to 651597c74 the extra condition wasn't strictly necessary because north-facing (default, no `f` sent) clients would've hit `c.y < y` (-1 < any valid Y coordinate) and have their facing set to north again. --- server/handlers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/handlers.go b/server/handlers.go index 0948c35..4b4c746 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -67,7 +67,9 @@ func (c *RoomClient) handleM(msg []string) error { return errconv } - if msg[0] == "m" { + // c.x and c.y get set at the same time + // only one needs to be checked + if msg[0] == "m" && c.x != -1 { switch { case y < c.y: c.facing = 0 // up