server cleaning

This commit is contained in:
Killian Marty 2023-12-08 17:46:12 +01:00
parent b4b3e4142e
commit 4ab6f5da50

View file

@ -161,18 +161,7 @@ wss.on('connection', (socket, req) => {
//handle disconnecting
socket.on('close', () => {
for (var i = players.length - 1; i >= 0; i--) {
broadcast(JSON.stringify({
type: "removePlayer",
data: {
id: socket.id
}
}));
if (players[i].id == socket.id) {
players.splice(i, 1);
}
}
connections.delete(socket);
deletePlayer(socket);
});
});