Skip to content

Commit

Permalink
fix(valve): dont skip players with no name (#449)
Browse files Browse the repository at this point in the history
* fix: dont skip players with no name

* feat: dont delete raw.players

* chore: update changelog
  • Loading branch information
CosminPerRam authored Jan 11, 2024
1 parent aa8b20b commit 184e9b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ see next point) and `tshock` (which is `terraria`).

#### Games
* Removed the players::setNum method, the library will no longer add empty players as
a placeholder in the `players` fields.
placeholders in the `players` fields.
* Valve: dont skip players with no name and keep state.raw.players.
* Stabilized field `numplayers`.
* BeamMP (2021) - Added support.

Expand Down
5 changes: 1 addition & 4 deletions protocols/valve.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ export default class valve extends Core {

this.logger.debug('Found player: ' + name + ' ' + score + ' ' + time)

// connecting players don't count as players.
if (!name) continue

// CSGO sometimes adds a bot named 'Max Players' if host_players_show is not 2
if (state.raw.appId === AppId.CSGO && name === 'Max Players') continue

Expand Down Expand Up @@ -274,7 +271,7 @@ export default class valve extends Core {
const sortedPlayers = state.raw.players.sort((a, b) => {
return botProbability(a) - botProbability(b)
})
delete state.raw.players

const numBots = state.raw.numbots || 0

while (state.bots.length < numBots && sortedPlayers.length) {
Expand Down

0 comments on commit 184e9b1

Please sign in to comment.