Harden lobby/game ready flow for out-of-order joins and stale clicks
This commit is contained in:
@@ -51,6 +51,9 @@ signal rule_suggestion_received(rules: Dictionary)
|
||||
## Pushed to the guest when the host rejects their rule suggestion.
|
||||
signal rule_suggestion_rejected
|
||||
|
||||
## Emitted when a lobby action is rejected gracefully (non-fatal), for lightweight UX toasts.
|
||||
signal lobby_notice(message: String)
|
||||
|
||||
# ── State ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
var lobby_id : String = ""
|
||||
@@ -174,8 +177,12 @@ func set_ready(deck_id: String, pref: String) -> void:
|
||||
first_turn_pref = pref
|
||||
Network.request("game.custom.lobby.ready",
|
||||
{ "lobbyId": lobby_id, "deckId": deck_id, "firstTurnPref": pref },
|
||||
func(_t: String, _p: Variant) -> void:
|
||||
i_am_ready = true,
|
||||
func(_t: String, p: Variant) -> void:
|
||||
var d := p as Dictionary
|
||||
var accepted := bool(d.get("isReady", true))
|
||||
i_am_ready = accepted
|
||||
if not accepted:
|
||||
lobby_notice.emit("Lobby is waiting for more players before ready-up.")
|
||||
func(code: String, msg: String) -> void:
|
||||
print("[CustomLobby] ERR set_ready ", code, " ", msg))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user