Skip to content

Commit

Permalink
add sfinv_buttons compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aBlueShadow authored and Athozus committed Jan 13, 2024
1 parent 3eafeb4 commit 94f37da
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ read_globals = {
"dump",

-- Deps
"unified_inventory", "default",
"unified_inventory", "default", "sfinv_buttons",

-- optional mods
"mtt", "canonical_name"
Expand Down
6 changes: 3 additions & 3 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 94f37da

Please sign in to comment.