fix: arch spirit placement field name, rules lock, and AI indicator

AiPlayerSession.ExecutePlacementAsync — NullReferenceException:
  Sent { Coord = ... } but GamePlaceArchSpiritRequest.Position is the
  field name. Changed to { Position = ... }.

GameUpdateLobbyRulesHandler — rules locked after adding AI:
  GuestReady=true is set when AI joins so the game auto-starts when
  host readies, but that flag was also blocking rule edits via
  CANNOT_CHANGE_RULES_WHILE_READY. Fix: inject IAiAccountRegistry
  (optional) and only block when a HUMAN guest is ready.

CustomLobby.gd — AI indicator not showing / rules reset on refresh:
  add_ai: populate ai_slots immediately from the game.ai.add ACK
  response so _refresh_display sees the AI before the push arrives.
  update_rules + lobby_updated push: keep lobby["rules"] in sync so
  _refresh_display() doesn't clobber _current_rules with stale data.

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-04-13 08:29:41 -04:00
co-authored by Claude Happy
parent 7eeb3acbf0
commit 23dc7925e2
3 changed files with 31 additions and 5 deletions
@@ -240,6 +240,7 @@ func update_rules(rules_override: Dictionary) -> void:
var d := p as Dictionary
var rules := d.get("rules", {}) as Dictionary
if not rules.is_empty():
lobby["rules"] = rules # keep lobby dict current for _refresh_display
lobby_rules_updated.emit(rules),
func(code: String, msg: String) -> void:
print("[CustomLobby] ERR update_rules ", code, " ", msg))
@@ -335,6 +336,19 @@ func add_ai(difficulty: int, strategy: String,
{ "lobbyId": lobby_id, "difficulty": difficulty, "strategy": strategy },
func(_t: String, p: Variant) -> void:
var d := p as Dictionary
# Update ai_slots immediately from the ACK so the display
# reflects the new AI before the push arrives.
var seat := int(d.get("seatIndex", 1))
ai_slots = ai_slots.filter(func(s: Dictionary) -> bool:
return int(s.get("seatIndex", -1)) != seat)
ai_slots.append({
"accountId": str(d.get("aiId", "")),
"displayName": str(d.get("displayName", "AI")),
"difficulty": difficulty,
"strategy": strategy,
"seatIndex": seat,
})
ai_slots_changed.emit(ai_slots)
if on_success.is_valid(): on_success.call(d),
func(code: String, msg: String) -> void:
print("[CustomLobby] ERR add_ai ", code, " ", msg)
@@ -363,6 +377,8 @@ func _on_server_push(type: String, payload: Variant) -> void:
"game.custom.lobby_updated":
var d := payload as Dictionary
var rules := d.get("newRules", {}) as Dictionary
if not rules.is_empty():
lobby["rules"] = rules # keep lobby dict current for _refresh_display
lobby_rules_updated.emit(rules)
"game.custom.lobby.deck_changed":