diff --git a/.luacheckrc b/.luacheckrc index 3b22541..fada0ab 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -13,7 +13,7 @@ read_globals = { "dump", -- Deps - "unified_inventory", "default", + "unified_inventory", "default", "sfinv_buttons", -- optional mods "mtt", "canonical_name" diff --git a/api.lua b/api.lua index 148d572..9533084 100644 --- a/api.lua +++ b/api.lua @@ -94,14 +94,14 @@ function mail.send(m) -- notify recipients that happen to be online local mail_alert = S("You have a new message from @1! Subject: @2", m.from, m.subject) .. "\n" .. S("To view it, type /mail") - local unified_inventory_alert = S("You could also use the button in your inventory.") + local inventory_alert = S("You could also use the button in your inventory.") for _, player in ipairs(minetest.get_connected_players()) do local name = player:get_player_name() if recipients[name] then if mail.get_setting(name, "chat_notifications") == true then minetest.chat_send_player(name, mail_alert) - if minetest.get_modpath("unified_inventory") then - minetest.chat_send_player(name, unified_inventory_alert) + if minetest.get_modpath("unified_inventory") or minetest.get_modpath("sfinv_buttons") then + minetest.chat_send_player(name, inventory_alert) end end if mail.get_setting(name, "sound_notifications") == true then diff --git a/gui.lua b/gui.lua index 3287360..1a4d0a6 100644 --- a/gui.lua +++ b/gui.lua @@ -10,3 +10,13 @@ if minetest.get_modpath("unified_inventory") then end }) end + +if minetest.get_modpath("sfinv_buttons") then + sfinv_buttons.register_button("mail", { + title = "Mail", + image = "mail_button.png", + action = function(player) + mail.show_mail_menu(player:get_player_name()) + end + }) +end diff --git a/mod.conf b/mod.conf index 31761be..fadef40 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = mail description = ingame mail-system -optional_depends = canonical_name,default,mtt,unified_inventory +optional_depends = canonical_name,default,mtt,unified_inventory,sfinv_buttons