Fix leave handler, partner-left push, and GDScript compile error
- GameLeaveCustomLobbyHandler: return success silently for Started/Cancelled status (allows the Leave button to work regardless of lobby state); inject IClientPush and send LobbyPartnerLeftPush to remaining participant when someone leaves a Full lobby; reset ready flags when guest leaves - GameMessages: add LobbyPartnerLeftPush(LobbyId, Reason) - CustomLobby.gd: add partner_left signal; handle game.custom.lobby.partner_left push by calling clear_state() then emitting partner_left - lobby_room_screen.gd: connect/disconnect partner_left; show toast + navigate back to FreePlayScreen when partner leaves - free_play_screen.gd: extract auto-select into _auto_select_deck() helper to fix GDScript parse error (comma inside multi-line if-body within lambda) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -40,6 +40,10 @@ signal preset_vote_rejected(lobby_id: String, preset_id: String)
|
||||
## Emitted locally when the player has left or cancelled the lobby.
|
||||
signal lobby_left
|
||||
|
||||
## Pushed by the server when the other participant leaves a Full lobby.
|
||||
## reason is "host_cancelled" or "guest_left".
|
||||
signal partner_left(reason: String)
|
||||
|
||||
# ── State ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
var lobby_id : String = ""
|
||||
@@ -253,3 +257,9 @@ func _on_server_push(type: String, payload: Variant) -> void:
|
||||
var lid := str(d.get("lobbyId", ""))
|
||||
var pid := str(d.get("presetId", ""))
|
||||
preset_vote_rejected.emit(lid, pid)
|
||||
|
||||
"game.custom.lobby.partner_left":
|
||||
var d := payload as Dictionary
|
||||
var reason : String = str(d.get("reason", ""))
|
||||
clear_state()
|
||||
partner_left.emit(reason)
|
||||
|
||||
Reference in New Issue
Block a user