diff --git a/server/chat-plugins/trivia.ts b/server/chat-plugins/trivia.ts index f21e6c3e93..dbfa7169ef 100644 --- a/server/chat-plugins/trivia.ts +++ b/server/chat-plugins/trivia.ts @@ -68,7 +68,6 @@ Object.setPrototypeOf(LENGTHS, null); const SIGNUP_PHASE = 'signups'; const QUESTION_PHASE = 'question'; const INTERMISSION_PHASE = 'intermission'; -const LIMBO_PHASE = 'limbo'; const MASTERMIND_ROUNDS_PHASE = 'rounds'; const MASTERMIND_FINALS_PHASE = 'finals'; @@ -76,7 +75,6 @@ const MASTERMIND_FINALS_PHASE = 'finals'; const MOVE_QUESTIONS_AFTER_USE_FROM_CATEGORY = 'event'; const MOVE_QUESTIONS_AFTER_USE_TO_CATEGORY = 'eventused'; -const MINIMUM_PLAYERS = 3; const START_TIMEOUT = 30 * 1000; const MASTERMIND_FINALS_START_TIMEOUT = 30 * 1000; const INTERMISSION_INTERVAL = 20 * 1000; @@ -401,7 +399,6 @@ class TriviaPlayer extends Rooms.RoomGamePlayer { export class Trivia extends Rooms.RoomGame { playerTable: {[k: string]: TriviaPlayer}; gameid: ID; - minPlayers: number; kickedUsers: Set; canLateJoin: boolean; game: TriviaGame; @@ -426,7 +423,6 @@ export class Trivia extends Rooms.RoomGame { this.allowRenames = true; this.playerCap = Number.MAX_SAFE_INTEGER; - this.minPlayers = MINIMUM_PLAYERS; this.kickedUsers = new Set(); this.canLateJoin = true; @@ -541,20 +537,6 @@ export class Trivia extends Rooms.RoomGame { if (!player?.isAbsent) return false; player.toggleAbsence(); - if (++this.playerCount < MINIMUM_PLAYERS) return false; - if (this.phase !== LIMBO_PHASE) return false; - - for (const i in this.playerTable) { - this.playerTable[i].clearAnswer(); - } - - broadcast( - this.room, - this.room.tr`Enough players have returned to continue the game!`, - this.room.tr`The game will continue with the next question.` - ); - this.askQuestion(); - return true; } onLeave(user: User, oldUserID: ID) { @@ -564,20 +546,6 @@ export class Trivia extends Rooms.RoomGame { if (!player || player.isAbsent) return false; player.toggleAbsence(); - if (--this.playerCount >= MINIMUM_PLAYERS) return false; - - // At least let the game start first!! - if (this.phase === SIGNUP_PHASE) return false; - - if (this.phaseTimeout) clearTimeout(this.phaseTimeout); - this.phaseTimeout = null; - this.phase = LIMBO_PHASE; - broadcast( - this.room, - this.room.tr`Not enough players are participating to continue the game!`, - this.room.tr`Until there are ${MINIMUM_PLAYERS} players participating and present, the game will be paused.` - ); - return true; } /** @@ -660,9 +628,6 @@ export class Trivia extends Rooms.RoomGame { */ start() { if (this.phase !== SIGNUP_PHASE) throw new Chat.ErrorMessage(this.room.tr`The game has already been started.`); - if (this.playerCount < this.minPlayers) { - throw new Chat.ErrorMessage(this.room.tr`Not enough players have signed up yet! At least ${this.minPlayers} players to begin.`); - } broadcast(this.room, this.room.tr`The game will begin in ${START_TIMEOUT / 1000} seconds...`); this.phase = INTERMISSION_PHASE; @@ -1476,7 +1441,6 @@ export class MastermindRound extends FirstModeTrivia { super(room, 'first', category, false, 'infinite', questions, 'Automatically Created', false, true); this.playerCap = 1; - this.minPlayers = 0; if (playerID) { const player = Users.get(playerID); const targetUsername = playerID; diff --git a/test/server/chat-plugins/trivia.js b/test/server/chat-plugins/trivia.js index fc3d411a97..c90ee653c6 100644 --- a/test/server/chat-plugins/trivia.js +++ b/test/server/chat-plugins/trivia.js @@ -189,19 +189,12 @@ describe('Trivia', function () { } }); - it('should mark a player absent on leave and pause the game', function () { + it('should mark a player absent on leave and unnmark them when they return', function () { this.user.leaveRoom(this.room); assert.equal(this.player.isAbsent, true); - assert.equal(this.game.phase, 'limbo'); - assert.equal(this.game.phaseTimeout, null); - }); - it('should unpause the game once enough players have returned', function () { - this.user.leaveRoom(this.room); this.user.joinRoom(this.room); assert.equal(this.player.isAbsent, false); - assert.equal(this.game.phase, 'question'); - assert(this.game.phaseTimeout); }); }); diff --git a/translations/english/trivia.ts b/translations/english/trivia.ts index ebfab25dea..53ee6f37fa 100644 --- a/translations/english/trivia.ts +++ b/translations/english/trivia.ts @@ -19,13 +19,13 @@ export const translations: Translations = { "Signups for a new trivia game have begun!": "", "Signups for a new unranked trivia game have begun!": "", "Mode: ${this.game.mode} | Category: ${this.game.category} | Score cap: ${this.getCap() || \"Infinite\"}
": "", - "Enter /trivia join to sign up for the trivia game.": "", + "Sign up for the Trivia game!": "", + " (You can also type /trivia join to sign up manually.)": "", "Mode: ${this.game.mode} | Category: ${this.game.category} | Score cap: ${this.getCap() || \"Infinite\"}": "", "User ${tarUser.name} has already been kicked from the game.": "", "User ${tarUser.name} is not a player in the game.": "", "You are not a player in the current game.": "", "The game has already been started.": "", - "Not enough players have signed up yet! At least ${this.minPlayers} players to begin.": "", "The game will begin in ${START_TIMEOUT / 1000} seconds...": "", "The trivia game is already paused.": "", "You cannot pause the trivia game during a question.": "",