Add match counter to game summary
parent
9d5cc8c8ab
commit
4457885349
|
@ -1,5 +1,6 @@
|
|||
local previous = nil
|
||||
local start_time = nil
|
||||
local game_stat = nil
|
||||
local winner = nil
|
||||
|
||||
local function team_rankings(total)
|
||||
|
@ -38,7 +39,7 @@ function ctf_modebase.summary.get(prev)
|
|||
rankings.players(), team_rankings(rankings.teams()), current_mode.summary_ranks, {
|
||||
title = "Match Summary",
|
||||
special_row_title = "Total Team Stats",
|
||||
gamemode = ctf_modebase.current_mode,
|
||||
game_stat = game_stat,
|
||||
winner = winner,
|
||||
duration = get_duration(),
|
||||
buttons = {previous = previous ~= nil},
|
||||
|
@ -48,7 +49,7 @@ function ctf_modebase.summary.get(prev)
|
|||
previous.players, team_rankings(previous.teams), previous.summary_ranks, {
|
||||
title = "Previous Match Summary",
|
||||
special_row_title = "Total Team Stats",
|
||||
gamemode = previous.gamemode,
|
||||
game_stat = previous.game_stat,
|
||||
winner = previous.winner,
|
||||
duration = previous.duration,
|
||||
buttons = {next = true},
|
||||
|
@ -56,6 +57,14 @@ function ctf_modebase.summary.get(prev)
|
|||
end
|
||||
end
|
||||
|
||||
ctf_api.register_on_new_match(function()
|
||||
game_stat = string.format("%s mode: Round %d of %d",
|
||||
HumanReadable(ctf_modebase.current_mode),
|
||||
ctf_modebase.current_mode_matches_played + 1,
|
||||
ctf_modebase.current_mode_matches
|
||||
)
|
||||
end)
|
||||
|
||||
ctf_api.register_on_match_start(function()
|
||||
start_time = os.time()
|
||||
end)
|
||||
|
@ -68,7 +77,7 @@ ctf_api.register_on_match_end(function()
|
|||
previous = {
|
||||
players = rankings.players(),
|
||||
teams = rankings.teams(),
|
||||
gamemode = ctf_modebase.current_mode,
|
||||
game_stat = game_stat,
|
||||
winner = winner or "NO WINNER",
|
||||
duration = get_duration(),
|
||||
summary_ranks = current_mode.summary_ranks,
|
||||
|
@ -213,11 +222,11 @@ function ctf_modebase.summary.show_gui_sorted(name, rankings, special_rankings,
|
|||
}
|
||||
end
|
||||
|
||||
if formdef.gamemode then
|
||||
formspec.elements.gamemode = {
|
||||
if formdef.game_stat then
|
||||
formspec.elements.game_stat = {
|
||||
type = "label",
|
||||
pos = {14, 0.5},
|
||||
label = HumanReadable(formdef.gamemode) .. " mode",
|
||||
pos = {11, 0.5},
|
||||
label = formdef.game_stat,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue