From 01988f31b9577de5601aacfddf9a0218e0d0f2de Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Thu, 2 Apr 2026 18:45:13 -0400 Subject: [PATCH 01/17] Update action_handlers.lua Adding notification of leaving opponent --- networking/action_handlers.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 3f52ad00..c49dd80b 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -335,6 +335,20 @@ local function action_stop_game() end end + +-- Notifcation leaving opponent +local function action_opponent_left() + attention_text({ + text = "Opponent left the lobby", + scale = 0.6, + hold = 3, + align = "cm", + offset = { x = 0, y = -2 }, + major = G.ROOM_ATTACH, + }) +end + + local function action_end_pvp() MP.GAME.end_pvp = true MP.GAME.timer = MP.LOBBY.config.timer_base_seconds @@ -912,9 +926,8 @@ function MP.ACTIONS.unready_blind() end function MP.ACTIONS.stop_game() - Client.send({ - action = "stopGame", - }) + Client.send({action = "stopGame", + Client.send({ action = "opponentLeft" }) end function MP.ACTIONS.fail_round(hands_used) @@ -1234,6 +1247,8 @@ function Game:update(dt) action_enemy_info(parsedAction.score, parsedAction.handsLeft, parsedAction.skips, parsedAction.lives) elseif parsedAction.action == "stopGame" then action_stop_game() + elseif parsedAction.action == "opponentLeft" then + action_opponent_left() elseif parsedAction.action == "endPvP" then action_end_pvp() elseif parsedAction.action == "playerInfo" then From 28d6daef26bab3ed85f3736a38589ef039acf8b1 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Thu, 2 Apr 2026 20:33:39 -0400 Subject: [PATCH 02/17] Update action_handlers.lua Add brackets.. --- networking/action_handlers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index c49dd80b..ddc9920b 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -926,7 +926,7 @@ function MP.ACTIONS.unready_blind() end function MP.ACTIONS.stop_game() - Client.send({action = "stopGame", + Client.send({action = "stopGame"}) Client.send({ action = "opponentLeft" }) end From 9deb46122136789552cd01dc917c0933a4ba61ca Mon Sep 17 00:00:00 2001 From: 26tscole <123657398+26tscole@users.noreply.github.com> Date: Tue, 7 Apr 2026 10:07:35 -0400 Subject: [PATCH 03/17] Revert "Update action_handlers.lua" This reverts commit 01988f31b9577de5601aacfddf9a0218e0d0f2de. --- networking/action_handlers.lua | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index ddc9920b..3f52ad00 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -335,20 +335,6 @@ local function action_stop_game() end end - --- Notifcation leaving opponent -local function action_opponent_left() - attention_text({ - text = "Opponent left the lobby", - scale = 0.6, - hold = 3, - align = "cm", - offset = { x = 0, y = -2 }, - major = G.ROOM_ATTACH, - }) -end - - local function action_end_pvp() MP.GAME.end_pvp = true MP.GAME.timer = MP.LOBBY.config.timer_base_seconds @@ -926,8 +912,9 @@ function MP.ACTIONS.unready_blind() end function MP.ACTIONS.stop_game() - Client.send({action = "stopGame"}) - Client.send({ action = "opponentLeft" }) + Client.send({ + action = "stopGame", + }) end function MP.ACTIONS.fail_round(hands_used) @@ -1247,8 +1234,6 @@ function Game:update(dt) action_enemy_info(parsedAction.score, parsedAction.handsLeft, parsedAction.skips, parsedAction.lives) elseif parsedAction.action == "stopGame" then action_stop_game() - elseif parsedAction.action == "opponentLeft" then - action_opponent_left() elseif parsedAction.action == "endPvP" then action_end_pvp() elseif parsedAction.action == "playerInfo" then From 931cd3a6d7130778ada973511425d96a92df47b0 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Tue, 7 Apr 2026 17:55:59 -0400 Subject: [PATCH 04/17] Update action_handlers.lua Added delay to server close, brought attention to opponent leaving --- networking/action_handlers.lua | 41 +++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 3f52ad00..dd182da1 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -328,11 +328,42 @@ end local function action_stop_game() MP.enemy_disconnect_countdown = nil - if G.STAGE ~= G.STAGES.MAIN_MENU then - G.FUNCS.go_to_menu() - MP.UI.update_connection_status() - MP.reset_game_states() - end + + -- Show the notification + attention_text({ + text = "Opponent left the lobby", + scale = 0.8, + hold = 2, + align = "cm", + offset = { x = 0, y = 0 }, + major = G.ROOM_ATTACH, + }) + + -- Event system for delay + G.E_MANAGER:add_event(Event({ + trigger = "after", + delay = 2.0, + func = function() + -- Clear lobby state first + MP.LOBBY.code = nil + MP.LOBBY.connected = false + MP.LOBBY.in_game = false + + -- Force reset to main menu + G.STATE = G.STATES.MENU + G.STATE_COMPLETE = false + + -- Clear any remaining UI + if G.OVERLAY_MENU then + G.FUNCS.exit_overlay_menu() + end + + -- Refresh the main menu UI + set_main_menu_UI() + + return true + end, + })) end local function action_end_pvp() From 364f13e689dd3e6e04209cf413eea8a9c00357be Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:14:07 -0400 Subject: [PATCH 05/17] Create maindev.yml creating tests for professors requirements --- .github/workflows/maindev.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/maindev.yml diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml new file mode 100644 index 00000000..2505b67a --- /dev/null +++ b/.github/workflows/maindev.yml @@ -0,0 +1,28 @@ +name: Test Multiplayer Mod + +on: + push: + branches: [ main, dev, issue147 ] + pull_request: + branches: [ main, dev ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Lua + uses: leafo/gh-actions-lua@v10 + with: + luaVersion: "5.4" + + - name: Setup LuaRocks + uses: leafo/gh-actions-luarocks@v4 + + - name: Install LuaCheck + run: luarocks install luacheck + + - name: Run LuaCheck + run: luacheck . --no-global From fadee8aaae5fc1521ccbe68b26514ebdb18ed37e Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:18:09 -0400 Subject: [PATCH 06/17] Update maindev.yml dont need main? exclude .luarocks file from test --- .github/workflows/maindev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index 2505b67a..3ed024e6 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -2,9 +2,9 @@ name: Test Multiplayer Mod on: push: - branches: [ main, dev, issue147 ] + branches: [ dev, issue147 ] pull_request: - branches: [ main, dev ] + branches: [ dev ] jobs: test: @@ -25,4 +25,4 @@ jobs: run: luarocks install luacheck - name: Run LuaCheck - run: luacheck . --no-global + run: luacheck . --no-global --exclude-files .luarocks From 73bd17644896a7072422984dfd49507237d91233 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:25:42 -0400 Subject: [PATCH 07/17] Update maindev.yml Checking syntax instead of just measuring --- .github/workflows/maindev.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index 3ed024e6..1078c285 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -18,11 +18,9 @@ jobs: with: luaVersion: "5.4" - - name: Setup LuaRocks - uses: leafo/gh-actions-luarocks@v4 - - - name: Install LuaCheck - run: luarocks install luacheck - - - name: Run LuaCheck - run: luacheck . --no-global --exclude-files .luarocks + - name: Syntax of all Lua files + run: | + for file in $(find . -name "*.lua" -not -path "./.git/*"); do + echo "Checking $file" + lua -p "$file" + done From 053c7aaa4767f0da5aa4fff8b21a06e491adb499 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:27:43 -0400 Subject: [PATCH 08/17] Update maindev.yml -p doesnt exist? assering loadfile isntead --- .github/workflows/maindev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index 1078c285..8bd9732c 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -22,5 +22,5 @@ jobs: run: | for file in $(find . -name "*.lua" -not -path "./.git/*"); do echo "Checking $file" - lua -p "$file" + lua -e "assert(loadfile('$file'))" done From 5327d194a7c058c22690bc777f0570dcc7425b7c Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:30:02 -0400 Subject: [PATCH 09/17] Update maindev.yml exclude ./.lua files --- .github/workflows/maindev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index 8bd9732c..287b0191 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -20,7 +20,7 @@ jobs: - name: Syntax of all Lua files run: | - for file in $(find . -name "*.lua" -not -path "./.git/*"); do + for file in $(find . -name "*.lua" -not -path "./.git/*" -not -path "./.lua/*"); do echo "Checking $file" lua -e "assert(loadfile('$file'))" done From d8fdd2707a5292bfcaf6e61701829e539c094af6 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:33:14 -0400 Subject: [PATCH 10/17] Update maindev.yml finding files instead of everything --- .github/workflows/maindev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index 287b0191..bf3541d9 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -20,7 +20,7 @@ jobs: - name: Syntax of all Lua files run: | - for file in $(find . -name "*.lua" -not -path "./.git/*" -not -path "./.lua/*"); do + for file in $(find . -type f -name "*.lua" -not -path "./.git/*"); do echo "Checking $file" lua -e "assert(loadfile('$file'))" done From 6081c4076babf3dfa661b7d1347f6ba0cb183003 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Wed, 8 Apr 2026 10:36:57 -0400 Subject: [PATCH 11/17] Update maindev.yml add issue-#147 actual name to syntax testing --- .github/workflows/maindev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index bf3541d9..f6c11f49 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -2,7 +2,7 @@ name: Test Multiplayer Mod on: push: - branches: [ dev, issue147 ] + branches: [ dev, issue-#147 ] pull_request: branches: [ dev ] From 25c11336d0bbc077d47512bb838a523d6ae72e19 Mon Sep 17 00:00:00 2001 From: 26tscole <123657398+26tscole@users.noreply.github.com> Date: Thu, 9 Apr 2026 00:16:05 -0400 Subject: [PATCH 12/17] workflow runs on any github push or action now --- .github/workflows/maindev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index f7729a10..b6611e74 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -2,9 +2,8 @@ name: Test Multiplayer Mod on: push: - branches: [ dev, issue-#147 ] pull_request: - branches: [ dev ] + workflow_dispatch: jobs: test: From 12c97076abbc7fd44162cdcde455333266933f32 Mon Sep 17 00:00:00 2001 From: 26tscole <123657398+26tscole@users.noreply.github.com> Date: Thu, 9 Apr 2026 00:18:12 -0400 Subject: [PATCH 13/17] busted installation on yml fixed --- .github/workflows/maindev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maindev.yml b/.github/workflows/maindev.yml index b6611e74..8f4e02ea 100644 --- a/.github/workflows/maindev.yml +++ b/.github/workflows/maindev.yml @@ -24,7 +24,7 @@ jobs: - name: Install Busted run: | - luarocks --lua-version=5.4 install busted + luarocks --lua-version=5.4 install --local busted echo "$HOME/.luarocks/bin" >> "$GITHUB_PATH" - name: Syntax of all Lua files From fa30ce247eb22ddf1bd276fdb6ae748f57033943 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Mon, 27 Apr 2026 12:49:50 -0400 Subject: [PATCH 14/17] Fix all decks appearing as Red Deck --- core.lua | 2 ++ lib/card_utils.lua | 34 +++++++++++++++++++++-- networking/action_handlers.lua | 17 +++++++++++- ui/lobby/deck_stake_button.lua | 14 ++++++++-- ui/lobby/lobby.lua | 50 +++++++++++++++++++++++----------- 5 files changed, 96 insertions(+), 21 deletions(-) diff --git a/core.lua b/core.lua index 8391e4a9..91389853 100644 --- a/core.lua +++ b/core.lua @@ -19,6 +19,7 @@ MP.LOBBY = { type = "", config = {}, -- Now set in MP.reset_lobby_config deck = { + back_key = "b_red", back = "Red Deck", sleeve = "sleeve_casl_none", stake = 1, @@ -171,6 +172,7 @@ function MP.reset_lobby_config(persist_ruleset_and_gamemode) weekly = nil, custom_seed = "random", different_decks = false, + back_key = "b_red", back = "Red Deck", sleeve = "sleeve_casl_none", stake = 1, diff --git a/lib/card_utils.lua b/lib/card_utils.lua index a4662688..67457bb0 100644 --- a/lib/card_utils.lua +++ b/lib/card_utils.lua @@ -84,10 +84,40 @@ function MP.UTILS.run_for_each_phantom_joker(key, func) end end -function MP.UTILS.get_deck_key_from_name(_name) +function MP.UTILS.get_deck_key_from_name(deck_name_or_key) + if not deck_name_or_key then + return "b_red" + end + + -- Already a valid key? + if G.P_CENTERS[deck_name_or_key] and G.P_CENTERS[deck_name_or_key].set == "Back" then + return deck_name_or_key + end + + -- Search by name (localized or raw) for k, v in pairs(G.P_CENTERS) do - if v.name == _name then return k end + if v.set == "Back" then + local loc_name = localize({type = 'name_text', key = k, set = 'Back'}) + if v.name == deck_name_or_key or loc_name == deck_name_or_key then + return k + end + end + end + + sendErrorMessage("MP.UTILS.get_deck_key_from_name: Could not find deck for '" .. tostring(deck_name_or_key) .. "'", "MULTIPLAYER") + return "b_red" +end + +function MP.UTILS.get_deck_name_from_key(deck_key) + if not deck_key then + return "Red Deck" end + + if G.P_CENTERS[deck_key] and G.P_CENTERS[deck_key].set == "Back" then + return G.P_CENTERS[deck_key].name or localize({type = 'name_text', key = deck_key, set = 'Back'}) + end + + return "Red Deck" end function MP.UTILS.get_culled_pool(_type, _rarity, _legendary, _append) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index dd182da1..367366f1 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -458,7 +458,22 @@ local function action_lobby_options(options) parsed_v = tonumber(v) end - MP.LOBBY.config[k] = parsed_v + if k == "back_key" then + MP.LOBBY.config.back_key = parsed_v + MP.LOBBY.config.back = MP.UTILS.get_deck_name_from_key(parsed_v) or parsed_v + elseif k == "back" then + local key = MP.UTILS.get_deck_key_from_name(parsed_v) + if key then + MP.LOBBY.config.back_key = key + MP.LOBBY.config.back = MP.UTILS.get_deck_name_from_key(key) + else + MP.LOBBY.config.back = parsed_v + end + else + MP.LOBBY.config[k] = parsed_v + end + + if MP.UI.update_lobby_option_toggle then MP.UI.update_lobby_option_toggle(k) end ::continue:: end diff --git a/ui/lobby/deck_stake_button.lua b/ui/lobby/deck_stake_button.lua index 340b8323..c227e849 100644 --- a/ui/lobby/deck_stake_button.lua +++ b/ui/lobby/deck_stake_button.lua @@ -2,10 +2,20 @@ local Disableable_Button = MP.UI.Disableable_Button -- Component for deck selection button in lobby function MP.UI.create_lobby_deck_button(text_scale, back, stake) + -- Determine the correct deck key (prefer stored key, fallback to converting name) + local deck_key + if MP.LOBBY.deck.back_key then + deck_key = MP.LOBBY.deck.back_key + elseif MP.LOBBY.config.back_key then + deck_key = MP.LOBBY.config.back_key + else + deck_key = MP.UTILS.get_deck_key_from_name(back) or "b_red" + end + local deck_labels = { localize({ type = "name_text", - key = MP.UTILS.get_deck_key_from_name(back), + key = deck_key, set = "Back", }), localize({ @@ -42,4 +52,4 @@ function MP.UI.create_lobby_deck_button(text_scale, back, stake) enabled_ref_value = "different_decks", }) end -end +end \ No newline at end of file diff --git a/ui/lobby/lobby.lua b/ui/lobby/lobby.lua index 8f899aa9..14a50c49 100644 --- a/ui/lobby/lobby.lua +++ b/ui/lobby/lobby.lua @@ -39,7 +39,15 @@ end function G.UIDEF.create_UIBox_lobby_menu() local text_scale = 0.45 - local back = MP.LOBBY.config.different_decks and MP.LOBBY.deck.back or MP.LOBBY.config.back + + -- Get deck key (prefer back_key, fallback to name) + local back_key + if MP.LOBBY.config.different_decks then + back_key = MP.LOBBY.deck.back_key or MP.LOBBY.deck.back + else + back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back + end + local back_name = MP.UTILS.get_deck_name_from_key(back_key) or "Red Deck" local stake = MP.LOBBY.config.different_decks and MP.LOBBY.deck.stake or MP.LOBBY.config.stake local t = { @@ -86,7 +94,7 @@ function G.UIDEF.create_UIBox_lobby_menu() col = true, }) or nil, MP.UI.create_spacer(), - MP.UI.create_lobby_deck_button(text_scale, back, stake), + MP.UI.create_lobby_deck_button(text_scale, back_name, stake), MP.UI.create_spacer(), MP.UI.create_players_section(text_scale), MP.UI.create_spacer(), @@ -263,12 +271,15 @@ function G.FUNCS.lobby_start_run(e, args) if MP.LOBBY.config.different_decks == false then G.FUNCS.copy_host_deck() end local challenge = nil - if MP.LOBBY.deck.back == "Challenge Deck" then + local deck_key = MP.LOBBY.deck.back_key or MP.LOBBY.deck.back + if deck_key == "Challenge Deck" or deck_key == "b_challenge_deck" then challenge = G.CHALLENGES[get_challenge_int_from_id(MP.LOBBY.deck.challenge)] else - G.GAME.viewed_back = G.P_CENTERS[MP.UTILS.get_deck_key_from_name(MP.LOBBY.deck.back)] + G.GAME.viewed_back = G.P_CENTERS[deck_key] end + + G.FUNCS.start_run(e, { mp_start = true, challenge = challenge, @@ -297,7 +308,8 @@ function Back:generate_UI(other, ui_scale, min_dims, challenge) end function G.FUNCS.copy_host_deck() - MP.LOBBY.deck.back = MP.LOBBY.config.back + MP.LOBBY.deck.back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back + MP.LOBBY.deck.back = MP.LOBBY.config.back -- keep for long term MP.LOBBY.deck.cocktail = MP.LOBBY.config.cocktail MP.LOBBY.deck.sleeve = MP.LOBBY.config.sleeve MP.LOBBY.deck.stake = MP.LOBBY.config.stake @@ -375,17 +387,23 @@ G.FUNCS.start_run = function(e, args) chosen_stake = MP.DECK.MAX_STAKE end if MP.LOBBY.is_host then - MP.LOBBY.config.back = args.challenge and "Challenge Deck" - or (args.deck and args.deck.name) - or G.GAME.viewed_back.name - MP.LOBBY.config.stake = chosen_stake - MP.LOBBY.config.sleeve = G.viewed_sleeve - MP.LOBBY.config.challenge = args.challenge and args.challenge.id or "" - send_lobby_options() - end - MP.LOBBY.deck.back = args.challenge and "Challenge Deck" - or (args.deck and args.deck.name) - or G.GAME.viewed_back.name + local deck_key = args.challenge and "Challenge Deck" + or (args.deck and MP.UTILS.get_deck_key_from_name(args.deck.name)) + or (G.GAME.viewed_back and G.GAME.viewed_back.key) + or "b_red" + MP.LOBBY.config.back_key = deck_key + MP.LOBBY.config.back = deck_key -- long + MP.LOBBY.config.stake = chosen_stake + MP.LOBBY.config.sleeve = G.viewed_sleeve + MP.LOBBY.config.challenge = args.challenge and args.challenge.id or "" + send_lobby_options() + end + local deck_key = args.challenge and "Challenge Deck" + or (args.deck and MP.UTILS.get_deck_key_from_name(args.deck.name)) + or (G.GAME.viewed_back and G.GAME.viewed_back.key) + or "b_red" + MP.LOBBY.deck.back_key = deck_key + MP.LOBBY.deck.back = deck_key -- long MP.LOBBY.deck.stake = chosen_stake MP.LOBBY.deck.sleeve = G.viewed_sleeve MP.LOBBY.deck.challenge = args.challenge and args.challenge.id or "" From a19992d18e65fd253565ec57ba978d827f5f78dd Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Tue, 28 Apr 2026 12:00:07 -0400 Subject: [PATCH 15/17] Updating UI for Host and Player in Lobby #Issue 373 --- networking/action_handlers.lua | 19 +++++++++++++++++++ ui/lobby/lobby.lua | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 367366f1..3622eac0 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -480,7 +480,26 @@ local function action_lobby_options(options) if different_decks_before ~= MP.LOBBY.config.different_decks then G.FUNCS.exit_overlay_menu() -- throw out guest from any menu. end + + if MP.LOBBY.code and G.MAIN_MENU_UI then + G.MAIN_MENU_UI:remove() + G.FUNCS.display_lobby_main_menu_UI() + end + MP.ACTIONS.update_player_usernames() -- render new DECK button state + + -- If different_decks is false, guest should see host's deck + if not MP.LOBBY.config.different_decks and not MP.LOBBY.is_host then + -- Sync guest's displayed deck to host's deck + MP.LOBBY.deck.back_key = MP.LOBBY.config.back_key + MP.LOBBY.deck.back = MP.LOBBY.config.back + end + + -- Force UI refresh + if MP.LOBBY.code and G.MAIN_MENU_UI then + G.MAIN_MENU_UI:remove() + G.FUNCS.display_lobby_main_menu_UI() + end end local function action_send_phantom(key) diff --git a/ui/lobby/lobby.lua b/ui/lobby/lobby.lua index 14a50c49..1b338bbd 100644 --- a/ui/lobby/lobby.lua +++ b/ui/lobby/lobby.lua @@ -43,9 +43,16 @@ function G.UIDEF.create_UIBox_lobby_menu() -- Get deck key (prefer back_key, fallback to name) local back_key if MP.LOBBY.config.different_decks then + -- Each player uses their own deck back_key = MP.LOBBY.deck.back_key or MP.LOBBY.deck.back else - back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back + -- Everyone uses host's deck + if MP.LOBBY.is_host then + back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back + else + -- Guest: use host's deck from config + back_key = MP.LOBBY.config.back_key or MP.LOBBY.deck.back_key or MP.LOBBY.deck.back + end end local back_name = MP.UTILS.get_deck_name_from_key(back_key) or "Red Deck" local stake = MP.LOBBY.config.different_decks and MP.LOBBY.deck.stake or MP.LOBBY.config.stake From 96022e68cb0f9b9b2ddedff4a124b67d228ef3d0 Mon Sep 17 00:00:00 2001 From: Wuamp-dev Date: Thu, 30 Apr 2026 17:27:28 -0400 Subject: [PATCH 16/17] Fixed issue with the soft lock after losing --- core.lua | 1 + networking/action_handlers.lua | 46 +++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/core.lua b/core.lua index 91389853..548377d1 100644 --- a/core.lua +++ b/core.lua @@ -219,6 +219,7 @@ function MP.reset_game_states() prevent_eval = false, round_ended = false, duplicate_end = false, + pvp_blind_started = false, misprint_display = "", spent_total = 0, spent_before_shop = 0, diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 3622eac0..6246374f 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -112,6 +112,25 @@ function Game:update(dt) handle_reconnect_timeout("Reconnection failed.\nReturning to main menu.") end end + -- Auto-detect stuck outside PvP blind + if MP.LOBBY.code and MP.is_pvp_boss() and not MP.GAME.pvp_blind_started then + + -- Check if opponent is already in PvP blind (has "playing" in their location) + if MP.GAME.enemy and MP.GAME.enemy.location and string.find(MP.GAME.enemy.location, "playing") then + sendDebugMessage("Auto-detected stuck outside PvP blind, recovering...", "MULTIPLAYER") + + -- Trigger the same unstuck logic that the button uses + if G.FUNCS.mp_unstuck_blind then + G.FUNCS.mp_unstuck_blind() + end + end + end + + -- Also reset the flag when leaving PvP state + if MP.LOBBY.code and not MP.is_pvp_boss() and MP.GAME.pvp_blind_started then + MP.GAME.pvp_blind_started = false + end + return _disconnect_gupdate(self, dt) end @@ -247,9 +266,18 @@ local function begin_pvp_blind() end local function action_start_blind() + + -- Reset state MP.GAME.ready_blind = false MP.GAME.timer_started = false MP.GAME.timer = MP.LOBBY.config.timer_base_seconds + MP.GAME.pvp_blind_started = true -- New flag + + -- Clear any pending stuck state + if MP.GAME.stuck_outside_pvp then + MP.GAME.stuck_outside_pvp = nil + end + MP.UI.start_pvp_countdown(begin_pvp_blind) end @@ -458,6 +486,7 @@ local function action_lobby_options(options) parsed_v = tonumber(v) end + -- Handle deck keys if k == "back_key" then MP.LOBBY.config.back_key = parsed_v MP.LOBBY.config.back = MP.UTILS.get_deck_name_from_key(parsed_v) or parsed_v @@ -473,33 +502,27 @@ local function action_lobby_options(options) MP.LOBBY.config[k] = parsed_v end - if MP.UI.update_lobby_option_toggle then MP.UI.update_lobby_option_toggle(k) end ::continue:: end - if different_decks_before ~= MP.LOBBY.config.different_decks then - G.FUNCS.exit_overlay_menu() -- throw out guest from any menu. - end - if MP.LOBBY.code and G.MAIN_MENU_UI then - G.MAIN_MENU_UI:remove() - G.FUNCS.display_lobby_main_menu_UI() + if different_decks_before ~= MP.LOBBY.config.different_decks then + G.FUNCS.exit_overlay_menu() end - MP.ACTIONS.update_player_usernames() -- render new DECK button state - -- If different_decks is false, guest should see host's deck if not MP.LOBBY.config.different_decks and not MP.LOBBY.is_host then - -- Sync guest's displayed deck to host's deck MP.LOBBY.deck.back_key = MP.LOBBY.config.back_key MP.LOBBY.deck.back = MP.LOBBY.config.back end - -- Force UI refresh + -- Force UI refresh (only once, at the end) if MP.LOBBY.code and G.MAIN_MENU_UI then G.MAIN_MENU_UI:remove() G.FUNCS.display_lobby_main_menu_UI() end + + MP.ACTIONS.update_player_usernames() end local function action_send_phantom(key) @@ -1243,7 +1266,6 @@ function Game:update(dt) end return end - local parsedAction = json.decode(msg) if not ((parsedAction.action == "keepAlive") or (parsedAction.action == "keepAliveAck")) then From 96cbc559ff1af603bb09ac0e38ca41941070b6fe Mon Sep 17 00:00:00 2001 From: 26tscole <123657398+26tscole@users.noreply.github.com> Date: Tue, 5 May 2026 14:06:32 -0400 Subject: [PATCH 17/17] Revert "Updating UI for Host and Player in Lobby" This reverts commit a19992d18e65fd253565ec57ba978d827f5f78dd. We had to do this so the commits could be moved to another branch --- networking/action_handlers.lua | 13 +------------ ui/lobby/lobby.lua | 9 +-------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/networking/action_handlers.lua b/networking/action_handlers.lua index 6246374f..f601cfff 100644 --- a/networking/action_handlers.lua +++ b/networking/action_handlers.lua @@ -510,19 +510,8 @@ local function action_lobby_options(options) G.FUNCS.exit_overlay_menu() end - -- If different_decks is false, guest should see host's deck - if not MP.LOBBY.config.different_decks and not MP.LOBBY.is_host then - MP.LOBBY.deck.back_key = MP.LOBBY.config.back_key - MP.LOBBY.deck.back = MP.LOBBY.config.back - end - - -- Force UI refresh (only once, at the end) - if MP.LOBBY.code and G.MAIN_MENU_UI then - G.MAIN_MENU_UI:remove() - G.FUNCS.display_lobby_main_menu_UI() - end + MP.ACTIONS.update_player_usernames() -- render new DECK button state - MP.ACTIONS.update_player_usernames() end local function action_send_phantom(key) diff --git a/ui/lobby/lobby.lua b/ui/lobby/lobby.lua index 1b338bbd..14a50c49 100644 --- a/ui/lobby/lobby.lua +++ b/ui/lobby/lobby.lua @@ -43,16 +43,9 @@ function G.UIDEF.create_UIBox_lobby_menu() -- Get deck key (prefer back_key, fallback to name) local back_key if MP.LOBBY.config.different_decks then - -- Each player uses their own deck back_key = MP.LOBBY.deck.back_key or MP.LOBBY.deck.back else - -- Everyone uses host's deck - if MP.LOBBY.is_host then - back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back - else - -- Guest: use host's deck from config - back_key = MP.LOBBY.config.back_key or MP.LOBBY.deck.back_key or MP.LOBBY.deck.back - end + back_key = MP.LOBBY.config.back_key or MP.LOBBY.config.back end local back_name = MP.UTILS.get_deck_name_from_key(back_key) or "Red Deck" local stake = MP.LOBBY.config.different_decks and MP.LOBBY.deck.stake or MP.LOBBY.config.stake