Change colors for /r output (#759)

* Change stats color when type /r

Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
Toby1710 2021-01-23 19:13:13 +02:00 committed by GitHub
parent 6fc6c8e871
commit b49909fc50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,8 +31,9 @@ local function return_as_chat_result(to, target)
end end
-- Build return string -- Build return string
local result = (to == name and "You are in " or name .. " is in ") .. local result = minetest.colorize("#63d437", (to == name and "You are in " or name .. " is in ")) ..
place .. " place.\n" minetest.colorize("#ffea00", place ..
minetest.colorize("#63d437", " place.\n"))
if stat then if stat then
local kd = stat.kills local kd = stat.kills
@ -40,13 +41,20 @@ local function return_as_chat_result(to, target)
kd = kd / stat.deaths kd = kd / stat.deaths
end end
result = result .. result = result ..
"Kills: " .. stat.kills .. minetest.colorize("#63d437", "Kills: ") ..
" | Deaths: " .. stat.deaths .. minetest.colorize("#ffea00", stat.kills ..
" | K/D: " .. math.floor(kd * 10) / 10 .. minetest.colorize("#63d437", " | Deaths: ")) ..
"\nBounty kills: " .. stat.bounty_kills .. minetest.colorize("#ffea00", stat.deaths ..
" | Captures: " .. stat.captures .. minetest.colorize("#63d437", " | K/D: ")) ..
" | Attempts: " .. stat.attempts .. minetest.colorize("#ffea00", math.floor(kd * 10) / 10 ..
"\nScore: " .. math.floor(stat.score) 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 end
return result return result
end end