fix: send full state_update to spectators instead of state_delta
Spectators were receiving game.state_delta in the normal delta path, but the client only handles game.state_update for spectator views. Always push a full game.state_update to spectators so they see every turn change without needing to reconnect. 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:
@@ -211,10 +211,11 @@ internal abstract class GameHandlerBase
|
||||
var spectators = registry.GetSpectators(session.Id);
|
||||
if (spectators.Count > 0)
|
||||
{
|
||||
var sd = GameStateDiffer.ComputeSpectatorDelta(prevState, state);
|
||||
var spectatorDto = GameEngine.ToDtoSpectator(state);
|
||||
foreach (var specId in spectators)
|
||||
tasks.Add(clientPush.PushAsync(specId.ToString(),
|
||||
ServerMessage.Push("game.state_delta", new GameStateDeltaPush(sd)), ct));
|
||||
ServerMessage.Push("game.state_update",
|
||||
new GameStateUpdatePush(spectatorDto)), ct));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user