Improve and fix some end-of-match formspec issues
* Fix clipped labels in end-of-match formspec * Improve format for match duration * Clean up code
This commit is contained in:
parent
d6b7ae9b61
commit
c1fe05b78f
1 changed files with 15 additions and 17 deletions
|
@ -41,6 +41,11 @@ function ctf_stats.get_formspec_match_summary(stats, winner_team, winner_player,
|
||||||
blue.score = blue.score + pstat.score
|
blue.score = blue.score + pstat.score
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local match_length = string.format("%02d:%02d:%02d",
|
||||||
|
math.floor(time/3600), -- hours
|
||||||
|
math.floor((time % 3600) / 60), -- minutes
|
||||||
|
math.floor(time % 60)) -- seconds
|
||||||
|
|
||||||
local ret = ctf_stats.get_formspec("Match Summary", players, 1)
|
local ret = ctf_stats.get_formspec("Match Summary", players, 1)
|
||||||
|
|
||||||
if stats[winner_team] then
|
if stats[winner_team] then
|
||||||
|
@ -52,21 +57,14 @@ function ctf_stats.get_formspec_match_summary(stats, winner_team, winner_player,
|
||||||
ret = ret .. "label[1,0;NO WINNER]"
|
ret = ret .. "label[1,0;NO WINNER]"
|
||||||
end
|
end
|
||||||
|
|
||||||
ret = ret .. "label[4,0;Kills]"
|
ret = ret .. "label[6.5,0;Kills]"
|
||||||
ret = ret .. "label[6,0;" .. render_per_team_stats(red, blue, "kills") .. "]"
|
ret = ret .. "label[8,0;" .. render_per_team_stats(red, blue, "kills") .. "]"
|
||||||
ret = ret .. "label[4,0.5;Attempts]"
|
ret = ret .. "label[6.5,0.5;Attempts]"
|
||||||
ret = ret .. "label[6,0.5;" .. render_per_team_stats(red, blue, "attempts") .. "]"
|
ret = ret .. "label[8,0.5;" .. render_per_team_stats(red, blue, "attempts") .. "]"
|
||||||
|
ret = ret .. "label[9.5,0;Duration]"
|
||||||
local time_display = ""
|
ret = ret .. "label[11,0;" .. match_length .. "]"
|
||||||
if time >= 3600 then
|
ret = ret .. "label[9.5,0.5;Total score]"
|
||||||
time_display = math.floor(time/3600) .. "h"
|
ret = ret .. "label[11,0.5;" .. render_per_team_stats(red, blue, "score", true) .. "]"
|
||||||
end
|
|
||||||
time_display = time_display .. math.floor((time % 3600) / 60) .. "m" .. math.floor(time % 60) .. "s"
|
|
||||||
ret = ret .. "label[8,0;Duration]"
|
|
||||||
ret = ret .. "label[10,0;" .. time_display .. "]"
|
|
||||||
ret = ret .. "label[8,0.5;Total score]"
|
|
||||||
ret = ret .. "label[10,0.5;" .. render_per_team_stats(red, blue, "score", true) .. "]"
|
|
||||||
|
|
||||||
ret = ret .. "label[3.5,7.2;Tip: type /rankings for league tables]"
|
ret = ret .. "label[3.5,7.2;Tip: type /rankings for league tables]"
|
||||||
|
|
||||||
-- Set prev_match_summary and write to mod_storage
|
-- Set prev_match_summary and write to mod_storage
|
||||||
|
@ -81,14 +79,14 @@ function ctf_stats.get_formspec(title, players, header, hlt_name)
|
||||||
return one.score > two.score
|
return one.score > two.score
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local ret = "size[12," .. 6.5 + header .. "]"
|
local ret = "size[13,"..6.5+header.."]"
|
||||||
ret = ret .. default.gui_bg .. default.gui_bg_img
|
ret = ret .. default.gui_bg .. default.gui_bg_img
|
||||||
ret = ret .. "container[0," .. header .. "]"
|
ret = ret .. "container[0," .. header .. "]"
|
||||||
|
|
||||||
ret = ret .. "vertlabel[0,0;" .. title .. "]"
|
ret = ret .. "vertlabel[0,0;" .. title .. "]"
|
||||||
ret = ret .. "tablecolumns[color;text;text;text;text;text;text;text;text;text]"
|
ret = ret .. "tablecolumns[color;text;text;text;text;text;text;text;text;text]"
|
||||||
ret = ret .. "tableoptions[highlight=#00000000]"
|
ret = ret .. "tableoptions[highlight=#00000000]"
|
||||||
ret = ret .. "table[0.5,0;11.25,6;scores;"
|
ret = ret .. "table[0.5,0;12.25,6;scores;"
|
||||||
ret = ret .. "#ffffff,,Player,Kills,Deaths,K/D ratio,Bounty kills,Captures,Attempts,Score"
|
ret = ret .. "#ffffff,,Player,Kills,Deaths,K/D ratio,Bounty kills,Captures,Attempts,Score"
|
||||||
|
|
||||||
local player_in_top_50 = false
|
local player_in_top_50 = false
|
||||||
|
|
Loading…
Reference in a new issue