From 0d1cc2b057e4ddc892e434e339bd8c8f8d952ed9 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 4 Feb 2025 14:08:57 +0100 Subject: [PATCH 01/18] Adds a delay to the pause feature --- lua/ui/game/gamemain.lua | 19 ++++++- lua/ui/game/pause.lua | 111 +++++++++++++++++++++++++++++++++++++++ lua/ui/game/tabs.lua | 14 +++-- 3 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 lua/ui/game/pause.lua diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index ce2b0a65056..72fe4570ba5 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -725,9 +725,12 @@ function OnQueueChanged(newQueue) end end --- Called after the Sim has confirmed the game is indeed paused. This will happen --- on everyone's machine in a network game. +--- Called by the engine after the sim confirmed that the game is indeed paused. This is run on all instances that are connected to the lobby. +---@param pausedBy integer # The index of the client in the clients list (that you get via `GetSessionClients`) +---@param timeoutsRemaining number function OnPause(pausedBy, timeoutsRemaining) + import("/lua/ui/game/pause.lua").OnPause(pausedBy, timeoutsRemaining) + PauseSound("World",true) PauseSound("Music",true) PauseVoice("VO",true) @@ -737,11 +740,19 @@ end -- Called after the Sim has confirmed that the game has resumed. local ResumedBy = nil + +--- Transmitted via a Chat command by another user to inform Lua who send the resume command. +---@param sender string # The name of the player that resumed the game. function SendResumedBy(sender) + import("/lua/ui/game/pause.lua").SendResumedBy(sender) + if not ResumedBy then ResumedBy = sender end end +--- Called by the engine when the simulation function OnResume() + import("/lua/ui/game/pause.lua").OnResume() + PauseSound("World",false) PauseSound("Music",false) PauseVoice("VO",false) @@ -753,6 +764,8 @@ end -- Called immediately when the user hits the pause button on the machine -- that initiated the pause and other network players won't call this function function OnUserPause(pause) + import("/lua/ui/game/pause.lua").OnUserPause(pause) + local Tabs = import("/lua/ui/game/tabs.lua") local focus = GetArmiesTable().focusArmy if Tabs.CanUserPause() then @@ -1051,6 +1064,8 @@ end ---@param sender string # username ---@param data table function ReceiveChat(sender, data) + LOG("ReceiveChat", sender) + reprsl(data) if data.Identifier then -- we highly encourage to use the 'Identifier' field to quickly identify the correct function diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua new file mode 100644 index 00000000000..ee587bc01c8 --- /dev/null +++ b/lua/ui/game/pause.lua @@ -0,0 +1,111 @@ +--****************************************************************************************************** +--** Copyright (c) 2025 Willem 'Jip' Wijnia +--** +--** Permission is hereby granted, free of charge, to any person obtaining a copy +--** of this software and associated documentation files (the "Software"), to deal +--** in the Software without restriction, including without limitation the rights +--** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +--** copies of the Software, and to permit persons to whom the Software is +--** furnished to do so, subject to the following conditions: +--** +--** The above copyright notice and this permission notice shall be included in all +--** copies or substantial portions of the Software. +--** +--** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +--** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +--** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +--** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +--** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +--** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +--** SOFTWARE. +--****************************************************************************************************** + +---@type integer +local OnPauseClientIndex = -1 + +---@type number +local OnPauseTimestamp = 0 + +---@type number +local PauseThreshold = 10 + +---@return integer # The index of the client, like the parameter `pausedBy` of OnPause +---@return Client? # The data of the client +local function FindLocalClient() + local allClients = GetSessionClients() + for k = 1, table.getn(allClients) do + local client = allClients[k] + if client["local"] then + return k, client + end + end + + return -1, nil +end + +--- Called by the engine when the simulation pauses for all clients. +---@param pausedBy integer # The index of the client in the clients list (that you get via `GetSessionClients`) +---@param timeoutsRemaining number +function OnPause(pausedBy, timeoutsRemaining) + -- keep track of who paused and when + OnPauseClientIndex = pausedBy + OnPauseTimestamp = GetSystemTimeSeconds() +end + +--- Called by the engine when the simulation resumed for all clients. +function OnResume() + OnPauseClientIndex = -1 + OnPauseTimestamp = 0 +end + +-- Called immediately by the engine on the machine that initiated the pause. This function is called only by the client that is initiating the (un)pause. +function OnUserPause(pause) +end + +local oldSessionRequestPause = _G.SessionRequestPause +_G.SessionRequestPause = function() + -- makes no sense to request a pause on top of a pause + if SessionIsPaused() then + return + end + + oldSessionRequestPause() +end + +local oldSessionResume = _G.SessionResume +---@return 'Accepted' | 'Declined' +_G.SessionResume = function() + LOG("SessionResume") + + -- scenario's that are all good + if SessionIsReplay() or + not SessionIsMultiplayer() + then + oldSessionResume() + return 'Accepted' + end + + -- local client initiated the pause, we're all good + local localClientIndex, clientData = FindLocalClient() + if OnPauseClientIndex == localClientIndex then + LOG("Same client unpauses") + oldSessionResume() + return 'Accepted' + end + + -- we waited long enough, we're good + if GetSystemTimeSeconds() - OnPauseTimestamp > PauseThreshold then + LOG("Threshold is met to resume") + oldSessionResume() + return 'Accepted' + end + + -- inform other clients + SessionSendChatMessage(import('/lua/ui/game/clientutils.lua').GetAll(), { + to = 'all', + text = 'Wants to continue the game', + Chat = true, + }) + + return 'Declined' +end diff --git a/lua/ui/game/tabs.lua b/lua/ui/game/tabs.lua index 8656f8f6c1f..92420bfb78f 100644 --- a/lua/ui/game/tabs.lua +++ b/lua/ui/game/tabs.lua @@ -506,16 +506,22 @@ function CommonLogic() end end tab.OnCheck = function(self, checked) - if checked then + if not SessionIsPaused() then if not CanUserPause() then return end + SessionRequestPause() self:SetGlowState(checked) else - SessionSendChatMessage({SendResumedBy=true}) - SessionResume() - self:SetGlowState(checked) + local status = SessionResume() + if status == 'Accepted' then + SessionSendChatMessage({SendResumedBy=true}) + self:SetGlowState(checked) + else + -- reset the check since the resume was declined + self:SetCheck(not checked, true) + end end end tab.OnClick = function(self, modifiers) From ddc0bdaaaa8a551b5d26888797a7cb65f2e9e485 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 4 Feb 2025 14:18:46 +0100 Subject: [PATCH 02/18] Add a changelog snippet --- changelog/snippets/features.6643.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/snippets/features.6643.md diff --git a/changelog/snippets/features.6643.md b/changelog/snippets/features.6643.md new file mode 100644 index 00000000000..034ecc82761 --- /dev/null +++ b/changelog/snippets/features.6643.md @@ -0,0 +1,3 @@ +- (#6643) Introduce a small enforced delay before a paused session can resume + +The delay applies to all players but the player that initiated the pause. The delay is 10 seconds. The delay is not configurable. From 8bbfb9bdff17b4a10061dc346a02548edf1bdc40 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 4 Feb 2025 16:27:12 +0100 Subject: [PATCH 03/18] Inform the user(s) about the delay --- lua/ui/game/pause.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index ee587bc01c8..d2c6bf584e4 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -94,18 +94,19 @@ _G.SessionResume = function() end -- we waited long enough, we're good - if GetSystemTimeSeconds() - OnPauseTimestamp > PauseThreshold then + local timeDifference = GetSystemTimeSeconds() - OnPauseTimestamp + if timeDifference > PauseThreshold then LOG("Threshold is met to resume") oldSessionResume() return 'Accepted' + else + -- inform other clients + SessionSendChatMessage(import('/lua/ui/game/clientutils.lua').GetAll(), { + to = 'all', + text = string.format('Wants to resume the game but has to wait %d seconds', PauseThreshold - timeDifference), + Chat = true, + }) + + return 'Declined' end - - -- inform other clients - SessionSendChatMessage(import('/lua/ui/game/clientutils.lua').GetAll(), { - to = 'all', - text = 'Wants to continue the game', - Chat = true, - }) - - return 'Declined' end From 9d7f0f91daea2e6adf7fa94899984a90d055634d Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 4 Feb 2025 16:27:24 +0100 Subject: [PATCH 04/18] Consistent choice of words --- lua/ui/game/gamemain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index 72fe4570ba5..566ca2dd08c 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -783,7 +783,7 @@ function OnUserPause(pause) else SessionSendChatMessage(import('/lua/ui/game/clientutils.lua').GetAll(), { to = 'all', - text = 'Unpaused the game', + text = 'Resumed the game', Chat = true, }) end From 1f551597ecd7f8e5a3b1c157dd8b2c23dad0e253 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:01:02 +0100 Subject: [PATCH 05/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index d2c6bf584e4..0eb4fe15ca2 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -93,7 +93,7 @@ _G.SessionResume = function() return 'Accepted' end - -- we waited long enough, we're good + -- unpause if we have waited longer than the unpause threshold local timeDifference = GetSystemTimeSeconds() - OnPauseTimestamp if timeDifference > PauseThreshold then LOG("Threshold is met to resume") From be8077ab1b03973d150a529b70170f11e87675a9 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:01:10 +0100 Subject: [PATCH 06/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 0eb4fe15ca2..5339a4fd001 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -85,7 +85,7 @@ _G.SessionResume = function() return 'Accepted' end - -- local client initiated the pause, we're all good + -- no unpause restriction if our local client initiated the pause local localClientIndex, clientData = FindLocalClient() if OnPauseClientIndex == localClientIndex then LOG("Same client unpauses") From 740d76751f7e75368ad89bdd21e26e64b2443db7 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:01:44 +0100 Subject: [PATCH 07/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 5339a4fd001..6b80f85ba03 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -77,7 +77,7 @@ local oldSessionResume = _G.SessionResume _G.SessionResume = function() LOG("SessionResume") - -- scenario's that are all good + -- no unpause restrictions in replays or singleplayer if SessionIsReplay() or not SessionIsMultiplayer() then From 07522f94f5f75bf290c710e48fb83b7c11529ca4 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:01:51 +0100 Subject: [PATCH 08/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 6b80f85ba03..ae4e187e32f 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -43,7 +43,7 @@ local function FindLocalClient() return -1, nil end ---- Called by the engine when the simulation pauses for all clients. +--- Called from `gamemain.lua` when the simulation pauses for all clients. ---@param pausedBy integer # The index of the client in the clients list (that you get via `GetSessionClients`) ---@param timeoutsRemaining number function OnPause(pausedBy, timeoutsRemaining) From 89ef4a8a86ccf9dc97cf6eddb2a057fbff90669f Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:01:58 +0100 Subject: [PATCH 09/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index ae4e187e32f..1bf1f055f33 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -35,7 +35,7 @@ local function FindLocalClient() local allClients = GetSessionClients() for k = 1, table.getn(allClients) do local client = allClients[k] - if client["local"] then + if client.local then return k, client end end From b28980027ad2f50c18ab57a46bb83e33664c56d9 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:02:46 +0100 Subject: [PATCH 10/18] Update lua/ui/game/gamemain.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/gamemain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index 566ca2dd08c..f0f6df5b475 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -741,7 +741,7 @@ end -- Called after the Sim has confirmed that the game has resumed. local ResumedBy = nil ---- Transmitted via a Chat command by another user to inform Lua who send the resume command. +--- Transmitted via a Chat command by another user to inform Lua who sent the resume command. ---@param sender string # The name of the player that resumed the game. function SendResumedBy(sender) import("/lua/ui/game/pause.lua").SendResumedBy(sender) From 374a25d309e3b87675e3364dfb4fb12a6d77231e Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:02:52 +0100 Subject: [PATCH 11/18] Update lua/ui/game/pause.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 1bf1f055f33..94e77c3f9f3 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -27,7 +27,7 @@ local OnPauseClientIndex = -1 local OnPauseTimestamp = 0 ---@type number -local PauseThreshold = 10 +local PauseThreshold = 10 -- seconds ---@return integer # The index of the client, like the parameter `pausedBy` of OnPause ---@return Client? # The data of the client From 43556abd6ccb6f0df6ee5e9c137b2bf5125f2bea Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Wed, 5 Feb 2025 14:03:06 +0100 Subject: [PATCH 12/18] Update lua/ui/game/gamemain.lua Co-authored-by: lL1l1 <82986251+lL1l1@users.noreply.github.com> --- lua/ui/game/gamemain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index f0f6df5b475..3e6dd7f4708 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -749,7 +749,7 @@ function SendResumedBy(sender) if not ResumedBy then ResumedBy = sender end end ---- Called by the engine when the simulation +--- Called by the engine when the simulation is resumed function OnResume() import("/lua/ui/game/pause.lua").OnResume() From 05456da1f27fac560b529be1739ff6c3588e3fcc Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Thu, 6 Feb 2025 17:44:15 +0100 Subject: [PATCH 13/18] Fix the use of `local` as a field --- lua/ui/game/pause.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 94e77c3f9f3..18a1e862f23 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -35,7 +35,7 @@ local function FindLocalClient() local allClients = GetSessionClients() for k = 1, table.getn(allClients) do local client = allClients[k] - if client.local then + if client["local"] then return k, client end end From 7eaafb75ceda80d8a38631ec1d0647c3707cd2f6 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Thu, 6 Feb 2025 17:48:04 +0100 Subject: [PATCH 14/18] Remove logging statements --- lua/ui/game/pause.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 18a1e862f23..1459cd1fed7 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -75,8 +75,6 @@ end local oldSessionResume = _G.SessionResume ---@return 'Accepted' | 'Declined' _G.SessionResume = function() - LOG("SessionResume") - -- no unpause restrictions in replays or singleplayer if SessionIsReplay() or not SessionIsMultiplayer() @@ -88,7 +86,6 @@ _G.SessionResume = function() -- no unpause restriction if our local client initiated the pause local localClientIndex, clientData = FindLocalClient() if OnPauseClientIndex == localClientIndex then - LOG("Same client unpauses") oldSessionResume() return 'Accepted' end @@ -96,7 +93,6 @@ _G.SessionResume = function() -- unpause if we have waited longer than the unpause threshold local timeDifference = GetSystemTimeSeconds() - OnPauseTimestamp if timeDifference > PauseThreshold then - LOG("Threshold is met to resume") oldSessionResume() return 'Accepted' else From e3232c87b8445e318747b1449e130322125c5e06 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Thu, 6 Feb 2025 17:49:55 +0100 Subject: [PATCH 15/18] Rename the threshold --- lua/ui/game/pause.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 1459cd1fed7..285b4809827 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -27,7 +27,7 @@ local OnPauseClientIndex = -1 local OnPauseTimestamp = 0 ---@type number -local PauseThreshold = 10 -- seconds +local ResumeThreshold = 10 -- seconds ---@return integer # The index of the client, like the parameter `pausedBy` of OnPause ---@return Client? # The data of the client @@ -92,14 +92,14 @@ _G.SessionResume = function() -- unpause if we have waited longer than the unpause threshold local timeDifference = GetSystemTimeSeconds() - OnPauseTimestamp - if timeDifference > PauseThreshold then + if timeDifference > ResumeThreshold then oldSessionResume() return 'Accepted' else -- inform other clients SessionSendChatMessage(import('/lua/ui/game/clientutils.lua').GetAll(), { to = 'all', - text = string.format('Wants to resume the game but has to wait %d seconds', PauseThreshold - timeDifference), + text = string.format('Wants to resume the game but has to wait %d seconds', ResumeThreshold - timeDifference), Chat = true, }) From d7122e3072b32950d3fba4e685037f033d6fa24c Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Fri, 7 Feb 2025 09:16:56 +0100 Subject: [PATCH 16/18] Refactor --- engine/User.lua | 9 +++++---- lua/ui/game/pause.lua | 24 ++++++++---------------- lua/ui/game/tabs.lua | 1 - 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/engine/User.lua b/engine/User.lua index 400b0869b17..262ef69e075 100644 --- a/engine/User.lua +++ b/engine/User.lua @@ -1096,10 +1096,11 @@ end --- Resume the world simulation function SessionResume() end - ---- ----@param client? number | number[] client or clients ----@param message table | number | string + +--- Sends a message to one, more or all other connected clients. This message is sent separately from the simulation. But it is sent in order. +---@overload fun(message: table | number | string) +---@param client? number | number[] # client or clients +---@param message table | number | string # function SessionSendChatMessage(client, message) end diff --git a/lua/ui/game/pause.lua b/lua/ui/game/pause.lua index 285b4809827..edab05d223c 100644 --- a/lua/ui/game/pause.lua +++ b/lua/ui/game/pause.lua @@ -75,24 +75,16 @@ end local oldSessionResume = _G.SessionResume ---@return 'Accepted' | 'Declined' _G.SessionResume = function() - -- no unpause restrictions in replays or singleplayer - if SessionIsReplay() or - not SessionIsMultiplayer() - then - oldSessionResume() - return 'Accepted' - end - - -- no unpause restriction if our local client initiated the pause local localClientIndex, clientData = FindLocalClient() - if OnPauseClientIndex == localClientIndex then - oldSessionResume() - return 'Accepted' - end - - -- unpause if we have waited longer than the unpause threshold local timeDifference = GetSystemTimeSeconds() - OnPauseTimestamp - if timeDifference > ResumeThreshold then + + -- conditions that allow an immediate resume of the session + if SessionIsReplay() or + not SessionIsMultiplayer() or + OnPauseClientIndex == localClientIndex or -- feature: the person who initiated the pause can resume at any time + timeDifference > ResumeThreshold -- feature: any person can resume after the pause lasted past the threshold + then + SessionSendChatMessage({ SendResumedBy = true }) oldSessionResume() return 'Accepted' else diff --git a/lua/ui/game/tabs.lua b/lua/ui/game/tabs.lua index 92420bfb78f..d27e2ead85d 100644 --- a/lua/ui/game/tabs.lua +++ b/lua/ui/game/tabs.lua @@ -516,7 +516,6 @@ function CommonLogic() else local status = SessionResume() if status == 'Accepted' then - SessionSendChatMessage({SendResumedBy=true}) self:SetGlowState(checked) else -- reset the check since the resume was declined From 499d678972b94ffc829f28ccc97e2ead9cf113d5 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Fri, 7 Feb 2025 09:20:04 +0100 Subject: [PATCH 17/18] Fix referencing missing function --- lua/ui/game/gamemain.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index 3e6dd7f4708..5927687bdee 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -744,8 +744,6 @@ local ResumedBy = nil --- Transmitted via a Chat command by another user to inform Lua who sent the resume command. ---@param sender string # The name of the player that resumed the game. function SendResumedBy(sender) - import("/lua/ui/game/pause.lua").SendResumedBy(sender) - if not ResumedBy then ResumedBy = sender end end From 2d213960ddf7636e85abadd5141a4bfe3e84d5aa Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 7 Feb 2025 01:51:45 -0800 Subject: [PATCH 18/18] Remove ReceiveChat logging statement --- lua/ui/game/gamemain.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index 5927687bdee..1f99cc9b571 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -1062,8 +1062,6 @@ end ---@param sender string # username ---@param data table function ReceiveChat(sender, data) - LOG("ReceiveChat", sender) - reprsl(data) if data.Identifier then -- we highly encourage to use the 'Identifier' field to quickly identify the correct function