This commit is contained in:
2025-04-02 14:34:41 +02:00
parent 2c9a14db9a
commit b85d4fffee
2 changed files with 3 additions and 3 deletions

View File

@@ -17,11 +17,12 @@ class Game{
setInterval(() => { setInterval(() => {
this.io.to(`game-${this.code}`).emit("waitForStart", this.players.length); this.io.to(`game-${this.code}`).emit("waitForStart", this.players.length);
this.io.to(`game-${this.code}`).emit("randomTest", Math.floor(Math.random() * 1000) + 1); this.io.to(`game-${this.code}`).emit("randomTest", Math.floor(Math.random() * 1000) + 1);
}, 1000); }, 100);
} }
addUser(user){ addUser(user){
if(this.players.length >= 2) return 1; if(this.players.length >= 2) return 1;
this.players.push(user); this.players.push(user);
} }
} }

View File

@@ -30,13 +30,12 @@ class GameManager {
}); });
}); });
console.log(oldLobbySave)
if(!wasInLobby) return 1; if(!wasInLobby) return 1;
if(!oldLobbySave.gameCode){ if(!oldLobbySave.gameCode){
const code = this.generateNonExistingCode(); const code = this.generateNonExistingCode();
const game = new Game(this.io, this, code); const game = new Game(this.io, this, code);
this.games.set(code, game); this.games.set(code, game);
oldLobbySave.gameCode = code; oldLobbySave.gameCode = code;