Fix rejoin opponent GUID + CDN skybox null/logging

- GameReadyResponse: add OpponentDisplayName? (populated only on AlreadyStarted)
- GameReadyHandler: inject SorIdentityDbContext; fetch opponent display name when
  session is already Active so rejoining clients get the name immediately
- Game.gd: on AlreadyStarted ack, read opponentDisplayName and set Game.opponent_name
  before calling _fetch_state() — fixes opponent showing as GUID on rejoin
- game_screen.gd: replace typed-Dictionary null assignment with safe Variant check
  to avoid silent GDScript coercion when no skybox is configured; strip query-string
  from URL before extension check (_fetch_skybox); add print logging throughout CDN
  skybox flow to surface download/decode failures

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-25 15:03:35 -04:00
co-authored by Claude Happy
parent 85e9b63579
commit 453f008620
4 changed files with 38 additions and 10 deletions
@@ -20,6 +20,7 @@ internal sealed class GameReadyHandler : GameHandlerBase, IMessageHandler
{
private readonly IMessageSerializer _serializer;
private readonly GameDbContext _gameDb;
private readonly SorIdentityDbContext _identityDb;
private readonly CollectionDbContext _collectionDb;
private readonly CatalogDbContext _catalogDb;
private readonly IClientPush _clientPush;
@@ -27,12 +28,14 @@ internal sealed class GameReadyHandler : GameHandlerBase, IMessageHandler
public GameReadyHandler(
IMessageSerializer serializer,
GameDbContext gameDb,
SorIdentityDbContext identityDb,
CollectionDbContext collectionDb,
CatalogDbContext catalogDb,
IClientPush clientPush)
{
_serializer = serializer;
_gameDb = gameDb;
_identityDb = identityDb;
_collectionDb = collectionDb;
_catalogDb = catalogDb;
_clientPush = clientPush;
@@ -71,8 +74,19 @@ internal sealed class GameReadyHandler : GameHandlerBase, IMessageHandler
if (session.Status == GameSessionStatus.Active)
{
await _gameDb.Database.CommitTransactionAsync(ct);
// Fetch the opponent's display name so the client can show it correctly on rejoin.
var opponentId = session.PlayerOneAccountId == accountId
? session.PlayerTwoAccountId
: session.PlayerOneAccountId;
var oppName = await _identityDb.Users
.AsNoTracking()
.Where(a => a.Id == opponentId)
.Select(a => a.DisplayName ?? a.UserName ?? a.Id.ToString().Substring(0, 8))
.FirstOrDefaultAsync(ct);
return ServerMessage.Reply("game.ready.ack", message.Seq,
new GameReadyResponse(session.Id, "AlreadyStarted"));
new GameReadyResponse(session.Id, "AlreadyStarted", oppName));
}
if (session.Status != GameSessionStatus.Initializing)