From 929ad9aefcf9f566b8b99a069450a636560bced7 Mon Sep 17 00:00:00 2001 From: flan Date: Fri, 1 Aug 2025 03:46:31 +0200 Subject: [PATCH] Change default facing direction to south to match liblcf Fixes an issue where a north-facing client would show up as south- facing to another player after the another player had reconnected. Client PR: https://github.com/ynoproject/ynoengine/pull/67 --- server/client.go | 4 +++- server/room.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/client.go b/server/client.go index da95224..c93efb8 100644 --- a/server/client.go +++ b/server/client.go @@ -33,6 +33,8 @@ const ( maxMessageSize = 4096 maxPictures = 1000 + + defaultFacing = 2 // down ) type Picture struct { @@ -303,7 +305,7 @@ func (c *RoomClient) disconnect() { func (c *RoomClient) reset() { c.x = -1 c.y = -1 - c.facing = 0 + c.facing = defaultFacing c.speed = 0 c.flash = [5]int{} diff --git a/server/room.go b/server/room.go index 0187274..677bccb 100644 --- a/server/room.go +++ b/server/room.go @@ -341,7 +341,7 @@ func (c *RoomClient) getPlayerData(client *RoomClient) { if client.x != -1 { c.outbox <- buildMsg("m", client.session.id, client.x, client.y) } - if client.facing != 0 { + if client.facing != defaultFacing { c.outbox <- buildMsg("f", client.session.id, client.facing) } if client.speed != 0 {