Cockatrice/webclient/src/websocket/commands/room/createGame.ts
2026-04-14 14:39:46 -05:00

13 lines
550 B
TypeScript

import { create } from '@bufbuild/protobuf';
import webClient from '../../WebClient';
import { Command_CreateGame_ext, Command_CreateGameSchema } from 'generated/proto/room_commands_pb';
import { RoomPersistence } from '../../persistence';
import { GameConfig } from 'types';
export function createGame(roomId: number, gameConfig: GameConfig): void {
webClient.protobuf.sendRoomCommand(roomId, Command_CreateGame_ext, create(Command_CreateGameSchema, gameConfig), {
onSuccess: () => {
RoomPersistence.gameCreated(roomId);
},
});
}