node-gamedig/protocols/jc2mp.js

22 lines
620 B
JavaScript
Raw Normal View History

const Gamespy3 = require('./gamespy3');
2014-10-29 08:02:03 +01:00
// supposedly, gamespy3 is the "official" query protocol for jcmp,
// but it's broken (requires useOnlySingleSplit), and doesn't include player names
class Jc2mp extends Gamespy3 {
2017-08-09 12:32:09 +02:00
constructor() {
super();
this.useOnlySingleSplit = true;
2019-01-09 12:35:11 +01:00
this.isJc2mp = true;
2017-08-09 12:32:09 +02:00
}
2019-01-09 12:35:11 +01:00
async run(state) {
super.run(state);
2017-08-09 12:32:09 +02:00
if(!state.players.length && parseInt(state.raw.numplayers)) {
for(let i = 0; i < parseInt(state.raw.numplayers); i++) {
state.players.push({});
}
}
}
}
module.exports = Jc2mp;