From ffdb5dd799ee4319d58f95529c5d9c3cfff701f3 Mon Sep 17 00:00:00 2001 From: ANAND Date: Mon, 23 Dec 2019 13:42:40 +0530 Subject: [PATCH] Add /s chat-command alias for /summary --- mods/ctf/ctf_stats/chat.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/mods/ctf/ctf_stats/chat.lua b/mods/ctf/ctf_stats/chat.lua index a327c5f..98c5602 100644 --- a/mods/ctf/ctf_stats/chat.lua +++ b/mods/ctf/ctf_stats/chat.lua @@ -51,20 +51,28 @@ local function return_as_chat_result(to, target) return result end +local function summary_func(name) + local fs = ctf_stats.get_formspec_match_summary(ctf_stats.current, + ctf_stats.winner_team, ctf_stats.winner_player, os.time() - ctf_stats.start) + + fs = fs .. "button[6,7.5;4,1;b_prev;<< Previous match]" + + minetest.log("action", name .. " requested match summary formspec") + minetest.show_formspec(name, "ctf_stats:match_summary", fs) +end + ------------------- -- Chat-commands -- ------------------- minetest.register_chatcommand("summary", { - func = function(name) - local fs = ctf_stats.get_formspec_match_summary(ctf_stats.current, - ctf_stats.winner_team, ctf_stats.winner_player, os.time() - ctf_stats.start) + description = "Display the match summary", + func = summary_func +}) - fs = fs .. "button[6,7.5;4,1;b_prev;<< Previous match]" - - minetest.log("action", name .. " requested match summary formspec") - minetest.show_formspec(name, "ctf_stats:match_summary", fs) - end +minetest.register_chatcommand("s", { + description = "Display the match summary", + func = summary_func }) minetest.register_chatcommand("r", {