mirror of
https://github.com/Tribufu/node-gamedig
synced 2026-08-09 15:11:06 +00:00
bunches of updates:
find bots in source engine add altaddress pass address to query object output
This commit is contained in:
parent
f543b301dd
commit
0d1577fa35
3 changed files with 27 additions and 2 deletions
|
|
@ -99,6 +99,24 @@ module.exports = require('./core').extend({
|
|||
name:name, score:score, time:time
|
||||
});
|
||||
}
|
||||
|
||||
// if we didn't find the bots, iterate
|
||||
// through and guess which ones they are
|
||||
if(!state.bots.length) {
|
||||
var maxTime = 0;
|
||||
state.players.forEach(function(player) {
|
||||
maxTime = Math.max(player.time,maxTime);
|
||||
});
|
||||
for(var i = 0; i < state.players.length; i++) {
|
||||
var player = state.players[i];
|
||||
if(state.bots.length >= state.raw.numbots) continue;
|
||||
if(player.time != maxTime) continue;
|
||||
state.bots.push(player);
|
||||
state.players.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
c();
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue