mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
replace restart with return to lobby, add mockup player options button
This commit is contained in:
@@ -215,7 +215,7 @@ class GameManager {
|
||||
}
|
||||
};
|
||||
|
||||
restartGame = async (game, namespace) => {
|
||||
restartGame = async (game, namespace, status = globals.STATUS.IN_PROGRESS) => {
|
||||
// kill any outstanding timer threads
|
||||
const subProcess = this.timerManager.timerThreads[game.accessCode];
|
||||
if (subProcess) {
|
||||
@@ -260,15 +260,19 @@ class GameManager {
|
||||
}
|
||||
}
|
||||
|
||||
// start the new game
|
||||
game.status = globals.STATUS.IN_PROGRESS;
|
||||
if (game.hasTimer) {
|
||||
game.timerParams.paused = true;
|
||||
game.timerParams.timeRemaining = convertFromHoursToMilliseconds(game.timerParams.hours) +
|
||||
convertFromMinutesToMilliseconds(game.timerParams.minutes);
|
||||
await this.timerManager.runTimer(game, namespace, this.eventManager, this);
|
||||
if (status === globals.STATUS.IN_PROGRESS) {
|
||||
game.status = globals.STATUS.IN_PROGRESS;
|
||||
if (game.hasTimer) {
|
||||
game.timerParams.paused = true;
|
||||
game.timerParams.timeRemaining = convertFromHoursToMilliseconds(game.timerParams.hours) +
|
||||
convertFromMinutesToMilliseconds(game.timerParams.minutes);
|
||||
await this.timerManager.runTimer(game, namespace, this.eventManager, this);
|
||||
}
|
||||
} else {
|
||||
game.status = globals.STATUS.LOBBY;
|
||||
}
|
||||
|
||||
|
||||
await this.refreshGame(game);
|
||||
await this.eventManager.publisher?.publish(
|
||||
globals.REDIS_CHANNELS.ACTIVE_GAME_STREAM,
|
||||
|
||||
Reference in New Issue
Block a user