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

@@ -13,6 +13,14 @@ module.exports = function(players) {
players: ps,
index: i
});

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


+ 1
- 1
package.json View File

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

+ 2
- 2
sections/game.js View File

@@ -39,9 +39,9 @@ module.exports = function(args, req, sock) {
stale: false
}

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

Loading…
Cancel
Save