Skip to content

Commit

Permalink
Rating now shows properly on the scoreboard again (FAForever#4355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored Nov 6, 2022
1 parent 4daec2c commit 4ee7346
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions lua/ui/game/score.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ local DisplayStorage = 0

local created = false

function updatePlayerName(line)
local playerName = line.name:GetText()
local playerRating = sessionInfo.Options.Ratings[playerName] or 0
local playerClan = sessionInfo.Options.ClanTags[playerName]

if playerClan and playerClan ~= "" then
playerClan = '[' .. playerClan .. '] '
else
playerClan = ""
end

if playerRating then
playerRating = ' [' .. math.floor(playerRating+0.5) .. ']'
end

line.name:SetText(playerClan .. playerName .. playerRating)
end

function armyGroupHeight()
local height = 0
for _, line in controls.armyLines do
Expand Down Expand Up @@ -489,21 +507,7 @@ function SetupPlayerLines()
end

for _, line in controls.armyLines do
local playerName = line.name:GetText()
local playerRating = sessionInfo.Options.Ratings[playerName] or 0
local playerClan = sessionInfo.Options.ClanTags[playerName]

if playerClan and playerClan ~= "" then
playerClan = '[' .. playerClan .. '] '
else
playerClan = ""
end

if playerRating then
playerRating = ' [' .. math.floor(playerRating+0.5) .. ']'
end

line.name:SetText(playerClan .. playerName .. playerRating)
updatePlayerName(line)
end

local mapData = {}
Expand Down Expand Up @@ -631,6 +635,7 @@ function _OnBeat()
if line.armyID == index then
if scoreData.name then
line.name:SetText(scoreData.name)
updatePlayerName(line)
end
if scoreData.general.score >= 0 then
line.score:SetText(fmtnum(scoreData.general.score))
Expand Down

0 comments on commit 4ee7346

Please sign in to comment.