vieux receive state change from admin

This commit is contained in:
catvayor 2023-06-11 17:42:48 +02:00
parent 84ca690684
commit 33f643642a

View file

@ -2,10 +2,11 @@
{ {
"id" : string, "id" : string,
"pos" : [lat : float, long : float], "pos" : [lat : float, long : float],
"vieux": bool,
"state" : { "state" : {
"shown" : bool, "shown" : bool,
"tracker" : bool, "tracker" : bool,
"npc" : bool "npc" : int
} }
} }
@ -182,6 +183,7 @@ function default_team(team_id, valid) {
state.tracker = false; state.tracker = false;
state.npc = valid; state.npc = valid;
equipe.state = state; equipe.state = state;
equipe.vieux = valid == 1;
equipe.pos = [0,0]; equipe.pos = [0,0];
equipe.id = team_id; equipe.id = team_id;
return equipe; return equipe;
@ -261,7 +263,9 @@ io.on('connection', function(socket){
socket.on('setState', function(d){ socket.on('setState', function(d){
equipes[d.id].state = d.state; equipes[d.id].state = d.state;
emit_update(d.id);//TODO update vieux emit_update(d.id);
if(equipes[d.id].vieux)
io.to(d.id).emit('newState', d.state);
}); });
for(i in equipes){ for(i in equipes){