mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-14 04:25:35 +01:00
fix(game): fix kickPlayer event to include gameId and improve reset message on player kick
This commit is contained in:
@@ -104,8 +104,8 @@ io.on("connection", (socket) => {
|
||||
withGame(gameId, socket, (game) => game.join(socket, data.username))
|
||||
)
|
||||
|
||||
socket.on("manager:kickPlayer", ({ gameId, data }) =>
|
||||
withGame(gameId, socket, (game) => game.kickPlayer(socket, data.playerId))
|
||||
socket.on("manager:kickPlayer", ({ gameId, playerId }) =>
|
||||
withGame(gameId, socket, (game) => game.kickPlayer(socket, playerId))
|
||||
)
|
||||
|
||||
socket.on("manager:startGame", ({ gameId }) =>
|
||||
|
||||
@@ -158,7 +158,9 @@ class Game {
|
||||
this.playerStatus.delete(playerId)
|
||||
|
||||
this.io.in(playerId).socketsLeave(this.gameId)
|
||||
this.io.to(player.id).emit("game:kick")
|
||||
this.io
|
||||
.to(player.id)
|
||||
.emit("game:reset", "You have been kicked by the manager")
|
||||
this.io.to(this.manager.id).emit("manager:playerKicked", player.id)
|
||||
|
||||
this.io.to(this.gameId).emit("game:totalPlayers", this.players.length)
|
||||
|
||||
Reference in New Issue
Block a user