Fix AI opponents in FreePlay 3+ player lobbies

- Remove max_players == 2 gate; use per-seat Add AI buttons in the
  additional players panel instead of the guest-slot button
- Fix seat-indexed panel rendering: unified loop over all additional
  seats detects AI slots, human players, and empty seats correctly
- Add _ai_adding guard to prevent concurrent add-AI requests that
  caused the server race (second request overwrote first AI slot)
- Fix push handler reading wrong key ("slots" → "currentAiSlots")
  which wiped ai_slots on every push, leaving only the newest AI
- Fix ACK handler reading wrong keys ("aiId"/"displayName" →
  "aiAccountId"/"aiDisplayName")
- Server: fix all-ready check that required GuestAccountId.HasValue,
  blocking start for no-guest lobbies filled via AdditionalPlayersJson
- Server: fix StartGameAsync null-deref on GuestAccountId and add
  no-guest branch (host=P1, first additional=P2, rest=seats 2+)

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-05-26 16:51:01 -04:00
co-authored by Claude Happy
parent 32693d303b
commit dfccd091fd
5 changed files with 137 additions and 75 deletions
@@ -77,7 +77,7 @@ func is_ruin_instance(iid: String) -> bool:
## Returns true when the tile has an occupant that blocks movement (i.e. not a Ruin).
func tile_has_blocking_occupant(tile: Dictionary) -> bool:
var occupant_id: String = str(tile.get("occupantId", ""))
if occupant_id.is_empty() or occupant_id == "null":
if occupant_id.is_empty() or occupant_id == "<null>" or occupant_id == "null":
print("[TileBlock] failing out")
return false
print("[TileBlock] returning this: ", not is_ruin_instance(occupant_id))