You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
968 B
29 lines
968 B
var peo = (client, room)=>{ |
|
|
|
let lastAct = ''; |
|
|
|
setInterval(()=>{ |
|
let act = ''; |
|
if(typeof room.act != "undefined") act = (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString()); |
|
else act = room.num.toString(); |
|
|
|
if(act != lastAct){ |
|
client.publish('peo/'+room.id, act); |
|
lastAct = act; |
|
} |
|
}, 500); |
|
/* |
|
room.on('peopleIn', ()=>{ |
|
client.publish('peo/'+room.id, room.num.toString()); |
|
if(typeof room.act != "undefined") client.publish('act/'+room.id, (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString())); |
|
}); |
|
|
|
room.on('peopleOut', ()=>{ |
|
client.publish('peo/'+room.id, room.num.toString()); |
|
if(typeof room.act != "undefined") client.publish('act/'+room.id, (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString())); |
|
}); |
|
|
|
*/ |
|
} |
|
|
|
exports.peo = peo;
|
|
|