Add chess premoves and time control metadata
- pass chess room time control to the client - add premove handling and richer chess board UI - update join result typing for room options
This commit is contained in:
@@ -244,7 +244,12 @@ export class GameServer {
|
||||
this.replacedConnections.delete(discordId);
|
||||
|
||||
// Build room options for the client
|
||||
const roomOptions = room?.betAmount ? { betAmount: room.betAmount } : undefined;
|
||||
const roomOptions = room
|
||||
? {
|
||||
...(room.betAmount > 0 ? { betAmount: room.betAmount } : {}),
|
||||
...(typeof room.options?.timeControl === "string" ? { timeControl: room.options.timeControl } : {}),
|
||||
}
|
||||
: undefined;
|
||||
|
||||
// Respond with JOIN_RESULT
|
||||
ws.send(JSON.stringify({
|
||||
|
||||
@@ -58,7 +58,7 @@ export type GameWsServerMessage =
|
||||
| { type: "GAME_STARTED"; roomId: string; state: unknown }
|
||||
| { type: "GAME_ENDED"; roomId: string; winner: string | null; reason: string; payout?: { amount: number; refunded?: boolean } }
|
||||
| { type: "ROOM_CREATED"; roomId: string; gameSlug: string }
|
||||
| { type: "JOIN_RESULT"; roomId: string; joinedAs: "player" | "spectator"; roomStatus: "waiting" | "playing" | "finished"; players: PlayerInfo[]; spectators: PlayerInfo[]; state?: unknown; roomOptions?: { betAmount?: number } }
|
||||
| { type: "JOIN_RESULT"; roomId: string; joinedAs: "player" | "spectator"; roomStatus: "waiting" | "playing" | "finished"; players: PlayerInfo[]; spectators: PlayerInfo[]; state?: unknown; roomOptions?: { betAmount?: number; timeControl?: string } }
|
||||
| { type: "ROUND_SETTLED"; roomId: string; payouts: Record<string, { net: number }> }
|
||||
| { type: "SESSION_REPLACED"; roomId: string }
|
||||
| { type: "ERROR"; message: string };
|
||||
|
||||
Reference in New Issue
Block a user