Allow a user to kick themselves from the game.
This commit is contained in:
parent
7a3e50d522
commit
5888f5e2a9
1 changed files with 2 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ export const KickPlayer = (io: Server, socket: Socket, data: KickPlayer) => {
|
|||
let game = active_games[data.game_code];
|
||||
|
||||
// Ensure it's the host kicking the player
|
||||
if (game.host !== data.user) {
|
||||
if (game.host !== data.user && data.user !== data.target) {
|
||||
log.info(`${data.user} attempted to kick ${data.target} from the game`);
|
||||
socket.emit(`PlayerKicked`, {
|
||||
success: false,
|
||||
|
|
@ -50,7 +50,7 @@ export const KickPlayer = (io: Server, socket: Socket, data: KickPlayer) => {
|
|||
io.sockets.connected[game.players[data.target].socket].leave(game.code);
|
||||
|
||||
game.remove_player(data.target, data.ban);
|
||||
log.info(`Removed ${data.target} from ${data.game_code}`);
|
||||
log.info(`${data.user} removed ${data.target} from ${data.game_code}`);
|
||||
|
||||
io.to(game.code).to(target_socket).emit(`PlayerKicked`, {
|
||||
success: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue