Fix game state push type and reconnect flow in Game.gd

- Server pushes "game.state_update" not "game.state_update.push"
- On "AlreadyStarted" ack (reconnect), explicitly fetch state via game.get_state
  instead of expecting state in the ready ack (it's never there)

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:
dingo
2026-03-07 09:33:56 -05:00
co-authored by Claude Happy
parent 7e4e4aad52
commit 84612614c5
+13 -1
View File
@@ -124,6 +124,18 @@ func board_height() -> int:
func send_ready() -> void:
Network.request("game.ready",
{ "sessionId": session_id },
func(_t: String, p: Variant) -> void:
var d := p as Dictionary
if d.get("status", "") == "AlreadyStarted":
_fetch_state()
else:
_apply_state_from_payload(p),
func(_c: String, _m: String) -> void: pass)
func _fetch_state() -> void:
Network.request("game.get_state",
{ "sessionId": session_id },
func(_t: String, p: Variant) -> void: _apply_state_from_payload(p),
func(_c: String, _m: String) -> void: pass)
@@ -231,7 +243,7 @@ func _on_server_push(type: String, payload: Variant) -> void:
opponent_name = oname
match_found.emit(sid, oname, orank)
"game.state_update.push":
"game.state_update":
var d := payload as Dictionary
var s := d.get("state", {}) as Dictionary
if not s.is_empty():