From 1683ba70a428b65a8404bf992178deed483500c2 Mon Sep 17 00:00:00 2001 From: -sniper- <47271658+JostP@users.noreply.github.com> Date: Tue, 8 Dec 2020 18:25:24 +0100 Subject: [PATCH] Colorize match start messages (#713) * add minetest.colorize * Change colors --- mods/ctf/ctf_map/ctf_map_core/schem_map.lua | 5 +++-- mods/ctf/ctf_match/buildtime.lua | 6 +++--- mods/ctf/ctf_match/matches.lua | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mods/ctf/ctf_map/ctf_map_core/schem_map.lua b/mods/ctf/ctf_map/ctf_map_core/schem_map.lua index f157963..1816f1b 100644 --- a/mods/ctf/ctf_map/ctf_map_core/schem_map.lua +++ b/mods/ctf/ctf_map/ctf_map_core/schem_map.lua @@ -349,9 +349,10 @@ local function place_map(map) end minetest.after(2, function() - local msg = "Map: " .. map.name .. " by " .. map.author + local msg = (minetest.colorize("#fcdb05", "Map: ") .. minetest.colorize("#f49200", map.name) .. + minetest.colorize("#fcdb05", " by ") .. minetest.colorize("#f49200", map.author)) if map.hint then - msg = msg .. "\n" .. map.hint + msg = msg .. "\n" .. minetest.colorize("#f49200", map.hint) end minetest.chat_send_all(msg) if minetest.global_exists("irc") and irc.connected then diff --git a/mods/ctf/ctf_match/buildtime.lua b/mods/ctf/ctf_match/buildtime.lua index 4e82ea4..d7cb35b 100644 --- a/mods/ctf/ctf_match/buildtime.lua +++ b/mods/ctf/ctf_match/buildtime.lua @@ -70,15 +70,15 @@ minetest.register_on_punchplayer(function(_, hitter) end) ctf_match.register_on_build_time_start(function() - minetest.chat_send_all("Prepare your base! Match starts in " .. - ctf.setting("match.build_time") .. " seconds.") + minetest.chat_send_all(minetest.colorize("#fcca05", ("Prepare your base! Match starts in " .. + ctf.setting("match.build_time") .. " seconds."))) end) ctf_match.register_on_build_time_end(function() if minetest.global_exists("chatplus") then chatplus.log("Build time over!") end - minetest.chat_send_all("Build time over! Attack and defend!") + minetest.chat_send_all(minetest.colorize("#dd5f04", "Build time over! Attack and defend!")) for _, player in pairs(minetest.get_connected_players()) do ctf.hud:remove(player, "ctf_match:countdown") end diff --git a/mods/ctf/ctf_match/matches.lua b/mods/ctf/ctf_match/matches.lua index 77698b9..fff445e 100644 --- a/mods/ctf/ctf_match/matches.lua +++ b/mods/ctf/ctf_match/matches.lua @@ -41,7 +41,7 @@ function ctf_match.next() ctf_alloc.set_all() - minetest.chat_send_all("Next round!") + minetest.chat_send_all(minetest.colorize("#4aaf01", "Next round!")) if minetest.global_exists("chatplus") then chatplus.log("Next round!") end @@ -62,7 +62,7 @@ function ctf_match.check_for_winner() if not game_won then game_won = true ctf.action("match", winner .. " won!") - minetest.chat_send_all("Team " .. winner .. " won!") + minetest.chat_send_all(minetest.colorize("#028704", ("Team " .. winner .. " won!"))) for i = 1, #ctf_match.registered_on_winner do ctf_match.registered_on_winner[i](winner) end @@ -99,7 +99,7 @@ ctf_flag.register_on_capture(function(attname, flag) if fl_team and #fl_team.flags == 0 then ctf.action("match", flag.team .. " was defeated.") ctf.remove_team(flag.team) - minetest.chat_send_all(flag.team .. " has been defeated!") + minetest.chat_send_all(minetest.colorize("#028704", (flag.team .. " has been defeated!"))) end ctf_match.check_for_winner()