Fix 3 multiplayer bugs: type error, reconnect, lobby count
- game_screen.gd: fix Parser Error on line 270 — use 'as Environment' cast instead of ': Variant' annotation for WorldEnvironment.environment - Game.gd: auto-resend game.ready on auth_success reconnect so the game session is restored when the WebSocket reconnects mid-game - lobby_browser_row.gd: show real N/Max player count instead of hardcoded "1/2" / "2/2" - CustomLobbyDto: add MaxPlayers, CurrentPlayerCount, GameMode, TeamCount - GameListCustomLobbiesHandler: compute currentPlayerCount from GuestAccountId + AdditionalPlayersJson; pass new fields to DTO 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:
@@ -59,6 +59,7 @@ var _state_version : int = -1
|
||||
func _ready() -> void:
|
||||
Network.message_received.connect(_on_server_push)
|
||||
Auth.session_expired.connect(_clear_state)
|
||||
Auth.auth_success.connect(_on_auth_reconnect)
|
||||
|
||||
|
||||
func _clear_state() -> void:
|
||||
@@ -69,6 +70,14 @@ func _clear_state() -> void:
|
||||
_state_version = -1
|
||||
|
||||
|
||||
## Called on every auth_success (initial login AND reconnects).
|
||||
## If we have an active session, resend game.ready so the server
|
||||
## re-registers this connection and we get state updates again.
|
||||
func _on_auth_reconnect(_uid: String, _dn: String) -> void:
|
||||
if not session_id.is_empty():
|
||||
send_ready()
|
||||
|
||||
|
||||
## Start spectating a game session. State is applied from the server ack.
|
||||
func start_spectating(sid: String) -> void:
|
||||
is_spectating = true
|
||||
|
||||
Reference in New Issue
Block a user