From 24c267c3b84044daea66995a41156f863cd94b0e Mon Sep 17 00:00:00 2001 From: ksandr <65916671+ksandronline@users.noreply.github.com> Date: Mon, 5 Jul 2021 23:54:47 +0300 Subject: [PATCH] Colorize leave messages (#909) * add leave message * Update mods/ctf/ctf_leave_message/init.lua Co-authored-by: David Leal * Update mods/ctf/ctf_leave_message/init.lua Co-authored-by: David Leal * Update mods/ctf/ctf_leave_message/mod.conf Co-authored-by: David Leal * Update mods/ctf/ctf_leave_message/init.lua Co-authored-by: David Leal * Update mods/ctf/ctf_leave_message/init.lua okay. Co-authored-by: David Leal * Update mods/ctf/ctf_leave_message/init.lua Co-authored-by: LoneWolfHT Co-authored-by: David Leal Co-authored-by: LoneWolfHT --- mods/ctf/ctf_leave_message/init.lua | 10 ++++++++++ mods/ctf/ctf_leave_message/mod.conf | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 mods/ctf/ctf_leave_message/init.lua create mode 100644 mods/ctf/ctf_leave_message/mod.conf diff --git a/mods/ctf/ctf_leave_message/init.lua b/mods/ctf/ctf_leave_message/init.lua new file mode 100644 index 0000000..c2b185d --- /dev/null +++ b/mods/ctf/ctf_leave_message/init.lua @@ -0,0 +1,10 @@ +function minetest.send_leave_message(player_name, timed_out) + local player = ctf.player(player_name) + local tcolor = ctf_colors.get_color(player).css + + local announcement = "*** " .. minetest.colorize(tcolor, player_name) .. " left the game." + if timed_out then + announcement = announcement .. " (timed out)" + end + minetest.chat_send_all(announcement) +end diff --git a/mods/ctf/ctf_leave_message/mod.conf b/mods/ctf/ctf_leave_message/mod.conf new file mode 100644 index 0000000..87ca448 --- /dev/null +++ b/mods/ctf/ctf_leave_message/mod.conf @@ -0,0 +1,3 @@ +name = ctf_leave_message +depends = ctf, ctf_colors +description = Colorizes leaving messages