Skip to content

Commit

Permalink
Use max players and spectators to calculate scoreboard rows
Browse files Browse the repository at this point in the history
  • Loading branch information
araszka committed Oct 6, 2024
1 parent a4d1589 commit e3782c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/Modules/ScoreboardModule/Services/ScoreboardService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,12 @@ public async Task SendScoreboardAsync()
private async Task<dynamic> GetDataAsync()
{
var currentNextMaxPlayers = await server.Remote.GetMaxPlayersAsync();
var maxPlayers = 128;
var currentNextMaxSpectators = await server.Remote.GetMaxSpectatorsAsync();

if (currentNextMaxPlayers.CurrentValue > 0)
return new
{
maxPlayers = currentNextMaxPlayers.CurrentValue;
}
else if (currentNextMaxPlayers.NextValue > 0)
{
maxPlayers = currentNextMaxPlayers.NextValue;
}

return new { settings, MaxPlayers = maxPlayers };
settings, MaxPlayers = currentNextMaxPlayers.CurrentValue + currentNextMaxSpectators.CurrentValue
};
}

public Task HideNadeoScoreboardAsync() =>
Expand Down
3 changes: 3 additions & 0 deletions src/Modules/ScoreboardModule/Templates/Scoreboard.mt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
declare roundPointsLabel = (playerRow.GetFirstChild("round_points") as CMlLabel);
declare customLabel = (playerRow.GetFirstChild("custom_label") as CMlLabel);

scoreLabel.Value = "";
roundPointsLabel.Value = "";

if (!(CustomPointsEnabled && CurrentScoreMode != C_Mode_Trophy)) {
HideCustomLabel(playerRow);
}
Expand Down

0 comments on commit e3782c2

Please sign in to comment.