Add Decagonal board shape, team reassignment, and multiplayer considerations
- BoardShapeGenerator: add MakeDecagonal() for 7-10 players (10-armed radial, 11x11 arena, 21x21 total); AutoShape now routes 7-10 to Decagonal - CustomLobby: add TeamAssignmentsJson (seat -> team override map) - GameMessages: add ReassignTeamRequest/Response, LobbyTeamAssignmentChangedPush, SeatTeams field on JoinCustomLobbyResponse - GameReassignTeamHandler: new game.custom.reassign_team handler (host-only); pushes team_reassigned to all participants including additional players - EF migration: AddTeamAssignmentsToLobby (applied to pg-forge-01) - Client CustomLobby.gd: seat_teams state, reassign_team() action, push handler - lobby_room_screen.gd: _rebuild_team_controls() renders host-only [<] Tx [>] cycle buttons per seat in team modes; _team_label() reads seat_teams overrides - OVERALL.md: add Considerations for Later (fog of war, asymmetric teams, ranked ELO) 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:
@@ -54,6 +54,9 @@ signal rule_suggestion_rejected
|
||||
## Emitted when a lobby action is rejected gracefully (non-fatal), for lightweight UX toasts.
|
||||
signal lobby_notice(message: String)
|
||||
|
||||
## Pushed (or acked) when the host changes a seat's team assignment.
|
||||
signal team_assignment_changed(seat_teams: Dictionary)
|
||||
|
||||
# ── State ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
var lobby_id : String = ""
|
||||
@@ -67,6 +70,8 @@ var first_turn_pref : String = "random"
|
||||
var max_players : int = 2
|
||||
var game_mode : String = "FFA"
|
||||
var team_count : int = 1
|
||||
## Seat index → team index overrides. Empty = use default (seat % team_count).
|
||||
var seat_teams : Dictionary = {}
|
||||
|
||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -87,6 +92,7 @@ func clear_state() -> void:
|
||||
max_players = 2
|
||||
game_mode = "FFA"
|
||||
team_count = 1
|
||||
seat_teams = {}
|
||||
|
||||
# ── Public actions ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -152,6 +158,13 @@ func join(lid: String, deck_id: String, password: String,
|
||||
lobby["guestDisplayName"] = str(d.get("guestDisplayName", ""))
|
||||
lobby["hasGuest"] = true
|
||||
lobby["additionalPlayers"] = d.get("additionalPlayers", [])
|
||||
# Apply team assignments from join response if present.
|
||||
var raw_st := d.get("seatTeams", null)
|
||||
if raw_st != null:
|
||||
seat_teams.clear()
|
||||
for k in (raw_st as Dictionary):
|
||||
seat_teams[int(k)] = int(raw_st[k])
|
||||
lobby["seatTeams"] = seat_teams
|
||||
if on_success.is_valid(): on_success.call(d),
|
||||
func(code: String, msg: String) -> void:
|
||||
print("[CustomLobby] ERR join ", code, " ", msg)
|
||||
@@ -290,6 +303,23 @@ func reject_rule_suggestion() -> void:
|
||||
func(code: String, msg: String) -> void:
|
||||
print("[CustomLobby] ERR reject_rule_suggestion ", code, " ", msg))
|
||||
|
||||
|
||||
## Host-only: reassign a player seat to a different team.
|
||||
func reassign_team(seat_index: int, team_index: int) -> void:
|
||||
Network.request("game.custom.reassign_team",
|
||||
{ "lobbyId": lobby_id, "seatIndex": seat_index, "teamIndex": team_index },
|
||||
func(_t: String, p: Variant) -> void:
|
||||
var d := p as Dictionary
|
||||
var raw := d.get("seatTeams", {}) as Dictionary
|
||||
seat_teams.clear()
|
||||
for k in raw:
|
||||
seat_teams[int(k)] = int(raw[k])
|
||||
lobby["seatTeams"] = seat_teams
|
||||
team_assignment_changed.emit(seat_teams),
|
||||
func(code: String, msg: String) -> void:
|
||||
print("[CustomLobby] ERR reassign_team ", code, " ", msg))
|
||||
|
||||
|
||||
# ── Private ───────────────────────────────────────────────────────────────────
|
||||
|
||||
func _on_server_push(type: String, payload: Variant) -> void:
|
||||
@@ -381,3 +411,12 @@ func _on_server_push(type: String, payload: Variant) -> void:
|
||||
|
||||
"game.custom.lobby.rule_suggestion.rejected":
|
||||
rule_suggestion_rejected.emit()
|
||||
|
||||
"game.custom.lobby.team_reassigned":
|
||||
var d := payload as Dictionary
|
||||
var raw := d.get("seatTeams", {}) as Dictionary
|
||||
seat_teams.clear()
|
||||
for k in raw:
|
||||
seat_teams[int(k)] = int(raw[k])
|
||||
lobby["seatTeams"] = seat_teams
|
||||
team_assignment_changed.emit(seat_teams)
|
||||
|
||||
Reference in New Issue
Block a user