Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(valve): dont skip players with no name #449

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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
Loading