Colorize match start messages (#713)

* add minetest.colorize

* Change colors
This commit is contained in:
-sniper- 2020-12-08 18:25:24 +01:00 committed by GitHub
parent 978c7ef641
commit 1683ba70a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View file

@ -349,9 +349,10 @@ local function place_map(map)
end end
minetest.after(2, function() 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 if map.hint then
msg = msg .. "\n" .. map.hint msg = msg .. "\n" .. minetest.colorize("#f49200", map.hint)
end end
minetest.chat_send_all(msg) minetest.chat_send_all(msg)
if minetest.global_exists("irc") and irc.connected then if minetest.global_exists("irc") and irc.connected then

View file

@ -70,15 +70,15 @@ minetest.register_on_punchplayer(function(_, hitter)
end) end)
ctf_match.register_on_build_time_start(function() ctf_match.register_on_build_time_start(function()
minetest.chat_send_all("Prepare your base! Match starts in " .. minetest.chat_send_all(minetest.colorize("#fcca05", ("Prepare your base! Match starts in " ..
ctf.setting("match.build_time") .. " seconds.") ctf.setting("match.build_time") .. " seconds.")))
end) end)
ctf_match.register_on_build_time_end(function() ctf_match.register_on_build_time_end(function()
if minetest.global_exists("chatplus") then if minetest.global_exists("chatplus") then
chatplus.log("Build time over!") chatplus.log("Build time over!")
end 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 for _, player in pairs(minetest.get_connected_players()) do
ctf.hud:remove(player, "ctf_match:countdown") ctf.hud:remove(player, "ctf_match:countdown")
end end

View file

@ -41,7 +41,7 @@ function ctf_match.next()
ctf_alloc.set_all() 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 if minetest.global_exists("chatplus") then
chatplus.log("Next round!") chatplus.log("Next round!")
end end
@ -62,7 +62,7 @@ function ctf_match.check_for_winner()
if not game_won then if not game_won then
game_won = true game_won = true
ctf.action("match", winner .. " won!") 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 for i = 1, #ctf_match.registered_on_winner do
ctf_match.registered_on_winner[i](winner) ctf_match.registered_on_winner[i](winner)
end end
@ -99,7 +99,7 @@ ctf_flag.register_on_capture(function(attname, flag)
if fl_team and #fl_team.flags == 0 then if fl_team and #fl_team.flags == 0 then
ctf.action("match", flag.team .. " was defeated.") ctf.action("match", flag.team .. " was defeated.")
ctf.remove_team(flag.team) 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 end
ctf_match.check_for_winner() ctf_match.check_for_winner()