From 5a875253578c00ab19a6807fb8ac2a3f399cc884 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 29 Jun 2015 20:32:43 +0200 Subject: [PATCH 1/2] Added IRC as optional dependency of fail - Failing and baking cookies now send the chat messages through IRC if available --- mods/fail/depends.txt | 1 + mods/fail/init.lua | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100755 mods/fail/depends.txt diff --git a/mods/fail/depends.txt b/mods/fail/depends.txt new file mode 100755 index 00000000..20efb189 --- /dev/null +++ b/mods/fail/depends.txt @@ -0,0 +1 @@ +irc? diff --git a/mods/fail/init.lua b/mods/fail/init.lua index 1c85865a..5b35c4f6 100755 --- a/mods/fail/init.lua +++ b/mods/fail/init.lua @@ -42,13 +42,17 @@ end data.send_func = function(name, msg) minetest.chat_send_player(name, msg) end if data.PUB_MSG then - data.send_func = function (name, msg) minetest.chat_send_all(msg) end + data.send_func = function (name, msg) + if irc then + irc:say(msg) + end + minetest.chat_send_all(msg) + end end data.is_player_available = minetest.get_player_by_name if data.STRICT_PLAYER_CHECK == false then - data.is_player_available = function (name) return (io.open(minetest.get_worldpath().."/players/"..name) ~= nil) end From 3189fa48d48677b794f1e604cf741fb7412c4d3c Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 29 Jun 2015 20:52:23 +0200 Subject: [PATCH 2/2] Check whether or not irc is enable before looking for its object --- mods/fail/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/fail/init.lua b/mods/fail/init.lua index 5b35c4f6..8e8511d5 100755 --- a/mods/fail/init.lua +++ b/mods/fail/init.lua @@ -43,7 +43,7 @@ data.send_func = function(name, msg) minetest.chat_send_player(name, msg) end if data.PUB_MSG then data.send_func = function (name, msg) - if irc then + if minetest.get_modpath("irc") then irc:say(msg) end minetest.chat_send_all(msg)