From 3fd033fe29074d11b5c90983a6af909541850d01 Mon Sep 17 00:00:00 2001 From: Endaris Date: Sat, 25 Oct 2025 19:38:55 +0200 Subject: [PATCH] don't send a reason for spectator leaves to clients --- client/src/network/NetClient.lua | 7 ++++++- server/Room.lua | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/network/NetClient.lua b/client/src/network/NetClient.lua index 4bb83eab1..93e992575 100644 --- a/client/src/network/NetClient.lua +++ b/client/src/network/NetClient.lua @@ -125,7 +125,12 @@ local function processLeaveRoomMessage(self, message) -- instead we actively abort the match ourselves self.room.match:abort() self.room.match:deinit() - transition = MessageTransition(love.timer.getTime(), 5, message.reason or "", false) + + if message.reason then + -- the server sends a reason for leaveRoom only if a player (not a spectator) in the room leaves/crashes/disconnects + -- the other player and spectators should be informed why the room is being closed + transition = MessageTransition(love.timer.getTime(), 5, message.reason, false) + end end -- and then shutdown the room diff --git a/server/Room.lua b/server/Room.lua index 87cc1d177..83906a755 100644 --- a/server/Room.lua +++ b/server/Room.lua @@ -192,7 +192,7 @@ function Room:remove_spectator(spectator) self.spectators[i].state = "lobby" logger.debug(spectator.name .. " left " .. self.name .. " as a spectator") table.remove(self.spectators, i) - spectator:removeFromRoom(self, spectator.name .. " left") + spectator:removeFromRoom(self) lobbyChanged = true break end