Skip to content

Commit 33f280d

Browse files
committed
clash win/lose
1 parent e440db1 commit 33f280d

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

networking/action_handlers.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ local function new_player_joined_lobby(player)
145145
end
146146

147147
local function action_game_stopped()
148-
if G.STAGE ~= G.STAGES.MAIN_MENU then
149-
G.FUNCS.go_to_menu()
150-
MP.UI.update_connection_status()
151-
MP.reset_game_states()
152-
end
148+
G.FUNCS.mp_return_to_lobby()
153149
end
154150

155151
local function action_reset_players(players)
@@ -471,6 +467,7 @@ local function action_spent_last_shop(player_id, amount)
471467
enemy.spent_in_shop[#enemy.spent_in_shop + 1] = tonumber(amount)
472468
end
473469

470+
-- TODO ready check is a bit broken when leaving games
474471
---@param ready_states table<string, boolean> <player_id, is_ready
475472
local function action_lobby_ready_update(ready_states)
476473
for player_id, is_ready in pairs(ready_states) do

ui/button_callbacks_lobby.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function G.FUNCS.custom_seed_overlay(e)
6464
end
6565

6666
G.FUNCS.change_pvp_countdown_seconds = function(args)
67-
MP.LOBBY.config.pvp_countdown_seconds = args.to_val
67+
MP.LOBBY.config.pvp_countdown_seconds = args.to_val
6868
MP.ACTIONS.update_lobby_options()
6969
end
7070

@@ -159,9 +159,9 @@ function G.FUNCS.lobby_leave(e)
159159
end
160160

161161
function G.FUNCS.open_lobby_options(e)
162-
G.FUNCS.overlay_menu({
163-
definition = G.UIDEF.create_UIBox_lobby_options(),
164-
})
162+
G.FUNCS.overlay_menu({
163+
definition = G.UIDEF.create_UIBox_lobby_options(),
164+
})
165165
end
166166

167167
function G.FUNCS.lobby_ready_up(e)
@@ -204,7 +204,11 @@ function G.FUNCS.lobby_start_run(e, args)
204204
end
205205

206206
function G.FUNCS.mp_return_to_lobby()
207-
MP.ACTIONS.stop_game()
207+
if G.STAGE ~= G.STAGES.MAIN_MENU then
208+
G.FUNCS.go_to_menu()
209+
MP.UI.update_connection_status()
210+
MP.reset_game_states()
211+
end
208212
end
209213

210214
function G.FUNCS.mp_toggle_ready(e)
@@ -350,9 +354,9 @@ G.FUNCS.view_player_hash = function(e)
350354
end
351355

352356
for gamemode, _ in pairs(MP.Gamemodes) do
353-
G.FUNCS["force_" .. gamemode] = function(e)
357+
G.FUNCS["force_" .. gamemode] = function(e)
354358
sendDebugMessage("Forcing gamemode: " .. gamemode, "MULTIPLAYER")
355-
MP.LOBBY.config.gamemode = gamemode
359+
MP.LOBBY.config.gamemode = gamemode
356360
G.FUNCS.start_lobby()
357361
end
358362
end

0 commit comments

Comments
 (0)