From b49909fc50706946465635750a3cc139dacccc60 Mon Sep 17 00:00:00 2001 From: Toby1710 <69259430+Toby1710@users.noreply.github.com> Date: Sat, 23 Jan 2021 19:13:13 +0200 Subject: [PATCH] Change colors for /r output (#759) * Change stats color when type /r Co-authored-by: David Leal --- mods/ctf/ctf_stats/chat.lua | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mods/ctf/ctf_stats/chat.lua b/mods/ctf/ctf_stats/chat.lua index 8b1ba56..a3f3aa5 100644 --- a/mods/ctf/ctf_stats/chat.lua +++ b/mods/ctf/ctf_stats/chat.lua @@ -31,8 +31,9 @@ local function return_as_chat_result(to, target) end -- Build return string - local result = (to == name and "You are in " or name .. " is in ") .. - place .. " place.\n" + local result = minetest.colorize("#63d437", (to == name and "You are in " or name .. " is in ")) .. + minetest.colorize("#ffea00", place .. + minetest.colorize("#63d437", " place.\n")) if stat then local kd = stat.kills @@ -40,13 +41,20 @@ local function return_as_chat_result(to, target) kd = kd / stat.deaths end result = result .. - "Kills: " .. stat.kills .. - " | Deaths: " .. stat.deaths .. - " | K/D: " .. math.floor(kd * 10) / 10 .. - "\nBounty kills: " .. stat.bounty_kills .. - " | Captures: " .. stat.captures .. - " | Attempts: " .. stat.attempts .. - "\nScore: " .. math.floor(stat.score) + minetest.colorize("#63d437", "Kills: ") .. + minetest.colorize("#ffea00", stat.kills .. + minetest.colorize("#63d437", " | Deaths: ")) .. + minetest.colorize("#ffea00", stat.deaths .. + minetest.colorize("#63d437", " | K/D: ")) .. + minetest.colorize("#ffea00", math.floor(kd * 10) / 10 .. + minetest.colorize("#63d437", "\nBounty kills: ")) .. + minetest.colorize("#ffea00", stat.bounty_kills .. + minetest.colorize("#63d437", " | Captures: ") .. + minetest.colorize("#ffea00", stat.captures .. + minetest.colorize("#63d437", " | Attempts: ")) .. + minetest.colorize("#ffea00", stat.attempts .. + minetest.colorize("#63d437", "\nScore: ")) .. + minetest.colorize("#ffea00", math.floor(stat.score))) end return result end