Skip to content

Commit

Permalink
Update scoreboard synchronization to reset progress and adjust bonus …
Browse files Browse the repository at this point in the history
…calculations when in ready state
  • Loading branch information
altair-sossai committed Nov 11, 2024
1 parent 35fc804 commit 35de260
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Binary file modified addons/sourcemod/plugins/optional/l4d2_gameinfo_sync.smx
Binary file not shown.
11 changes: 7 additions & 4 deletions addons/sourcemod/scripting/l4d2_gameinfo_sync.sp
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,16 @@ void SendScoreboard()
JSONObject command = new JSONObject();

int flipped = GameRules_GetProp("m_bAreTeamsFlipped");
bool isInReady = IsInReady();
int bonus = SMPlus_GetHealthBonus() + SMPlus_GetDamageBonus() + SMPlus_GetPillsBonus();
int maxBonus = SMPlus_GetMaxHealthBonus() + SMPlus_GetMaxDamageBonus() + SMPlus_GetMaxPillsBonus();

command.SetInt("survivorScore", L4D2Direct_GetVSCampaignScore(flipped ? 1 : 0) + L4D_GetTeamScore(flipped ? 2 : 1));
command.SetInt("infectedScore", L4D2Direct_GetVSCampaignScore(flipped ? 0 : 1) + L4D_GetTeamScore(flipped ? 1 : 2));
command.SetInt("bonus", SMPlus_GetHealthBonus() + SMPlus_GetDamageBonus() + SMPlus_GetPillsBonus());
command.SetInt("maxBonus", SMPlus_GetMaxHealthBonus() + SMPlus_GetMaxDamageBonus() + SMPlus_GetMaxPillsBonus());
command.SetFloat("currentProgress", IsInReady() ? 0.0 : (GetCurrentProgress() / 100.0));
command.SetInt("currentProgressPoints", L4D_GetTeamScore(flipped ? 2 : 1));
command.SetInt("bonus", isInReady ? maxBonus : bonus);
command.SetInt("maxBonus", maxBonus);
command.SetFloat("currentProgress", isInReady ? 0.0 : (GetCurrentProgress() / 100.0));
command.SetInt("currentProgressPoints", isInReady ? 0 : L4D_GetTeamScore(flipped ? 2 : 1));

HTTPRequest request = BuildHTTPRequest("/api/game-info/scoreboard");

Expand Down

0 comments on commit 35de260

Please sign in to comment.