Skip to content

Commit

Permalink
fix: remove another instance of adding empty player objects valve
Browse files Browse the repository at this point in the history
Related: #389
  • Loading branch information
CosminPerRam committed Dec 25, 2023
1 parent dcc69a3 commit 90e26bb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions protocols/valve.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,12 @@ export default class valve extends Core {
})
delete state.raw.players
const numBots = state.raw.numbots || 0
while (state.bots.length < numBots) {
if (sortedPlayers.length) state.bots.push(sortedPlayers.pop())
else state.bots.push({})

while (state.bots.length < numBots && sortedPlayers.length) {
state.bots.push(sortedPlayers.pop())
}
while (state.players.length < state.numplayers - numBots || sortedPlayers.length) {
if (sortedPlayers.length) state.players.push(sortedPlayers.pop())
else state.players.push({})
while ((state.players.length < state.numplayers - numBots || sortedPlayers.length) && sortedPlayers.length) {
state.players.push(sortedPlayers.pop())
}
}

Expand Down

0 comments on commit 90e26bb

Please sign in to comment.