Improve starmade protocol

This commit is contained in:
mmorrison 2019-02-05 03:19:06 -06:00
parent eba10df217
commit 2ffeda6098
2 changed files with 33 additions and 17 deletions

View file

@ -102,15 +102,21 @@ class Core extends EventEmitter {
if (typeof state.players === 'number') {
const num = state.players;
state.players = [];
for (let i = 0; i < num; i++) {
state.players.push({});
state.raw.rcvNumPlayers = num;
if (num < 10000) {
for (let i = 0; i < num; i++) {
state.players.push({});
}
}
}
if (typeof state.bots === 'number') {
const num = state.bots;
state.bots = [];
for (let i = 0; i < num; i++) {
state.bots.push({});
state.raw.rcvNumBots = num;
if (num < 10000) {
for (let i = 0; i < num; i++) {
state.bots.push({});
}
}
}