Skip to content

Commit 7ba7ae7

Browse files
committed
games: Don't reassign state from Scrabble when subbing before game starts
1 parent 1f6925d commit 7ba7ae7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/ps/games/scrabble/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ export class Scrabble extends Game<State> {
338338
}
339339

340340
onReplacePlayer(oldPlayer: string, withPlayer: User): ActionResponse<Partial<Player>> {
341-
[this.state.score, this.state.racks, this.state.best].forEach(state => {
342-
state[withPlayer.id] = state[oldPlayer];
343-
delete state[oldPlayer];
344-
});
341+
if (this.started) {
342+
[this.state.score, this.state.racks, this.state.best].forEach(state => {
343+
state[withPlayer.id] = state[oldPlayer];
344+
delete state[oldPlayer];
345+
});
346+
}
345347
return { success: true, data: {} };
346348
}
347349

0 commit comments

Comments
 (0)