INNER CODE UNIT · JavaScript
addSocket
Dannark/BWO · bwo-server/core/game.js:59
function addSocket(socket) {
socketList.push(socket)
}
function removeSocket(id) {
delete socketList[id]
}
function notifyAllOnRangeOfPlayer(command, playerId, ignoreSelf = false) {
//console.log(`> notifyAllOnRangeOfPlayer:`, command, `(${state.statistics.msgRecived}) `)
var type = command.type;
var allPlayers = getAllPlayersAround(playerId, ignoreSelf);
command.action == undefined? delete command.action: null;
for (const skt of socketList) {
if (allPlayers[skt.id] != undefined) {
delete command.type
skt.emit(type, command)
state.statistics.msgSent ++