From a7606f1c74fd55c4416265d30761165ff3f9e203 Mon Sep 17 00:00:00 2001 From: catvayor Date: Fri, 9 Sep 2022 17:37:30 +0200 Subject: [PATCH] hide on disconnection --- traque.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/traque.js b/traque.js index d31676b..ae9b5fe 100644 --- a/traque.js +++ b/traque.js @@ -84,6 +84,12 @@ io.sockets.on('connection', function(socket){ for(i in equipes) equipes[i].emit('setName', {"id": socket.id, "name": d.name}); }); + socket.on("disconnect", function(_){ + socket.shown = false; + socket.color = -1; + for(i in equipes) + equipes[i].emit('changeColor', {"id": socket.id, "color": -1}); + }); socket.emit('yourId', {"id": socket.id}); for(i in equipes){