Fix rules editor: allow Open state + update UI from ACK

Server (GameUpdateLobbyRulesHandler):
- Allow update_rules in both Open (solo) and Full lobby states,
  not just Full — was silently failing when no guest had joined yet
- Push to guest only when GuestAccountId is present (was crashing
  with null deref in Open state if status check had been bypassed)

Client (CustomLobby.gd):
- update_rules ACK callback now emits lobby_rules_updated immediately
  from the ACK payload instead of relying solely on the lobby_updated push

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-20 21:28:58 -04:00
co-authored by Claude Happy
parent 66e7f75155
commit a84a610964
2 changed files with 18 additions and 9 deletions
@@ -171,11 +171,16 @@ func change_deck(deck_id: String) -> void:
print("[CustomLobby] ERR change_deck ", code, " ", msg))
## Host-only: update lobby rule overrides (only when neither player is ready).
## Host-only: update lobby rule overrides (open or full lobby, neither player ready).
func update_rules(rules_override: Dictionary) -> void:
Network.request("game.custom.update_rules",
{ "lobbyId": lobby_id, "rules": rules_override },
func(_t: String, _p: Variant) -> void: pass,
func(_t: String, p: Variant) -> void:
# Apply new rules immediately from the ACK (don't wait for the push).
var d := p as Dictionary
var rules := d.get("rules", {}) as Dictionary
if not rules.is_empty():
lobby_rules_updated.emit(rules),
func(code: String, msg: String) -> void:
print("[CustomLobby] ERR update_rules ", code, " ", msg))