mirror of
https://github.com/mt-mods/mail.git
synced 2025-03-20 16:41:25 +00:00
add sfinv_buttons compatibility
This commit is contained in:
parent
3eafeb4cf8
commit
94f37da092
4 changed files with 15 additions and 5 deletions
|
@ -13,7 +13,7 @@ read_globals = {
|
||||||
"dump",
|
"dump",
|
||||||
|
|
||||||
-- Deps
|
-- Deps
|
||||||
"unified_inventory", "default",
|
"unified_inventory", "default", "sfinv_buttons",
|
||||||
|
|
||||||
-- optional mods
|
-- optional mods
|
||||||
"mtt", "canonical_name"
|
"mtt", "canonical_name"
|
||||||
|
|
6
api.lua
6
api.lua
|
@ -94,14 +94,14 @@ function mail.send(m)
|
||||||
-- notify recipients that happen to be online
|
-- notify recipients that happen to be online
|
||||||
local mail_alert = S("You have a new message from @1! Subject: @2", m.from, m.subject) ..
|
local mail_alert = S("You have a new message from @1! Subject: @2", m.from, m.subject) ..
|
||||||
"\n" .. S("To view it, type /mail")
|
"\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
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if recipients[name] then
|
if recipients[name] then
|
||||||
if mail.get_setting(name, "chat_notifications") == true then
|
if mail.get_setting(name, "chat_notifications") == true then
|
||||||
minetest.chat_send_player(name, mail_alert)
|
minetest.chat_send_player(name, mail_alert)
|
||||||
if minetest.get_modpath("unified_inventory") then
|
if minetest.get_modpath("unified_inventory") or minetest.get_modpath("sfinv_buttons") then
|
||||||
minetest.chat_send_player(name, unified_inventory_alert)
|
minetest.chat_send_player(name, inventory_alert)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mail.get_setting(name, "sound_notifications") == true then
|
if mail.get_setting(name, "sound_notifications") == true then
|
||||||
|
|
10
gui.lua
10
gui.lua
|
@ -10,3 +10,13 @@ if minetest.get_modpath("unified_inventory") then
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
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
mod.conf
2
mod.conf
|
@ -1,3 +1,3 @@
|
||||||
name = mail
|
name = mail
|
||||||
description = ingame mail-system
|
description = ingame mail-system
|
||||||
optional_depends = canonical_name,default,mtt,unified_inventory
|
optional_depends = canonical_name,default,mtt,unified_inventory,sfinv_buttons
|
||||||
|
|
Loading…
Add table
Reference in a new issue