Browse Source

basic matchmaking works

master
mort 8 years ago
parent
commit
472e81b043
3 changed files with 11 additions and 3 deletions
  1. 8
    0
      js/game.js
  2. 1
    1
      package.json
  3. 2
    2
      sections/game.js

+ 8
- 0
js/game.js View File

players: ps, players: ps,
index: i index: i
}); });

p.on("close", function() {
players.forEach(function(p, i) {
p.send("gameover", {
msg: "Opponent quit."
});
});
});
}); });
} }



+ 1
- 1
package.json View File

"author": "Martin Dørum Nygaard", "author": "Martin Dørum Nygaard",
"license": "GPL-2.0", "license": "GPL-2.0",
"dependencies": { "dependencies": {
"socksugar": "^0.2.0"
"socksugar": "^0.3.1"
} }
} }

+ 2
- 2
sections/game.js View File

stale: false stale: false
} }


if (args[2] === "runner") {
if (req.data.type === "runner") {
queues.runners.push(sock); queues.runners.push(sock);
} else if (args[2] === "god") {
} else if (req.data.type === "god") {
queues.gods.push(sock); queues.gods.push(sock);
} else { } else {
return req.fail(); return req.fail();

Loading…
Cancel
Save