ajoute timeout pour invisible
This commit is contained in:
parent
f1cd3f2207
commit
875e079730
1 changed files with 9 additions and 0 deletions
|
@ -24,6 +24,7 @@ var MSG_BAD = "Code Incorrect";
|
||||||
var MSG_TRACKED = "Vous êtes maintenant traqué.e.s !"
|
var MSG_TRACKED = "Vous êtes maintenant traqué.e.s !"
|
||||||
var MSG_TRACKER = "Vous pouvez maintenant traquer !";
|
var MSG_TRACKER = "Vous pouvez maintenant traquer !";
|
||||||
var MSG_INVISIBLE = "Les autres équipes ne peuvent plus vous voir !";
|
var MSG_INVISIBLE = "Les autres équipes ne peuvent plus vous voir !";
|
||||||
|
var invisible_delay = 3*60*1000;
|
||||||
|
|
||||||
var equipes = [];
|
var equipes = [];
|
||||||
var admins = [];
|
var admins = [];
|
||||||
|
@ -121,8 +122,16 @@ io.sockets.on('connection', function(socket){
|
||||||
}
|
}
|
||||||
else if((d.content in invisi) && invisi[d.content]){
|
else if((d.content in invisi) && invisi[d.content]){
|
||||||
invisi[d.content] = false;
|
invisi[d.content] = false;
|
||||||
|
old_color = socket.color;
|
||||||
d.color = -1;
|
d.color = -1;
|
||||||
socket.emit('popup', {"content": MSG_INVISIBLE});
|
socket.emit('popup', {"content": MSG_INVISIBLE});
|
||||||
|
setTimeout(function(s,c){
|
||||||
|
for(i in equipes){
|
||||||
|
equipes[i].emit('moving', {"id": s.id, "position": s.position});
|
||||||
|
equipes[i].emit('changeColor', {"id": s.id, "color": c, "debug": "timeout"});
|
||||||
|
s.color = c;
|
||||||
|
}
|
||||||
|
}, invisible_delay, socket, old_color);
|
||||||
} else {
|
} else {
|
||||||
socket.emit('popup', {"content": MSG_BAD});
|
socket.emit('popup', {"content": MSG_BAD});
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue