Update rooms.ts for numeric player IDs

- Changed Player.id from string to number
- Removed name field from Player interface
- Updated publicRoom to not expose name field
- Players are now identified by numeric IDs only
This commit is contained in:
2026-04-08 18:48:07 -05:00
parent f5af850cf3
commit 010b5a593e

View File

@@ -11,11 +11,10 @@ export interface RoomSettings {
} }
export interface Player { export interface Player {
id: string; id: number;
name: string; teamIndex: number | null;
teamIndex: number | null; ws: ServerWebSocket<unknown> | null;
ws: ServerWebSocket<unknown> | null; isConnected: boolean;
isConnected: boolean;
} }
export interface BuzzerState { export interface BuzzerState {
@@ -69,23 +68,22 @@ export function freshBuzzer(): BuzzerState {
} }
export function publicRoom(room: Room) { export function publicRoom(room: Room) {
return { return {
id: room.id, id: room.id,
settings: room.settings, settings: room.settings,
locked: room.locked, locked: room.locked,
teamLocked: room.teamLocked, teamLocked: room.teamLocked,
modOnline: room.modWs !== null, modOnline: room.modWs !== null,
buzzerState: { buzzerState: {
roundOpen: room.buzzerState.roundOpen, roundOpen: room.buzzerState.roundOpen,
buzzOrder: room.buzzerState.buzzOrder, buzzOrder: room.buzzerState.buzzOrder,
}, },
players: Array.from(room.players.values()).map(p => ({ players: Array.from(room.players.values()).map(p => ({
id: p.id, id: p.id,
name: p.name, teamIndex: p.teamIndex,
teamIndex: p.teamIndex, isConnected: p.isConnected,
isConnected: p.isConnected, })),
})), };
};
} }
export function broadcast(room: Room, msg: object, exclude?: ServerWebSocket<unknown>) { export function broadcast(room: Room, msg: object, exclude?: ServerWebSocket<unknown>) {