mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
Add sound notification
This commit is contained in:
parent
a79ebd94b8
commit
27875f26b4
7 changed files with 14 additions and 1 deletions
|
@ -62,6 +62,7 @@ See the "LICENSE" file
|
|||
* imre84 (UI fixes)
|
||||
* Chache (Spanish translation)
|
||||
* APercy (Brazilian Portuguese translation)
|
||||
* bennstir (mail_notif.ogg - https://freesound.org/people/bennstir/sounds/81072/)
|
||||
|
||||
# Contribute
|
||||
|
||||
|
|
3
api.lua
3
api.lua
|
@ -106,6 +106,9 @@ function mail.send(m)
|
|||
minetest.chat_send_player(name, unified_inventory_alert)
|
||||
end
|
||||
end
|
||||
if mail.get_setting(name, "sound_notifications") == true then
|
||||
minetest.sound_play("mail_notif", {to_player=name})
|
||||
end
|
||||
local receiver_entry = mail.get_storage_entry(name)
|
||||
local receiver_messages = receiver_entry.inbox
|
||||
mail.hud_update(name, receiver_messages)
|
||||
|
|
1
init.lua
1
init.lua
|
@ -30,6 +30,7 @@ mail = {
|
|||
chat_notifications = {},
|
||||
onjoin_notifications = {},
|
||||
hud_notifications = {},
|
||||
sound_notifications = {},
|
||||
unreadcolorenable = {},
|
||||
cccolorenable = {}
|
||||
},
|
||||
|
|
BIN
sounds/mail_notif.ogg
Normal file
BIN
sounds/mail_notif.ogg
Normal file
Binary file not shown.
|
@ -263,6 +263,7 @@ function mail.get_setting_default_value(setting_name)
|
|||
chat_notifications = true,
|
||||
onjoin_notifications = true,
|
||||
hud_notifications = true,
|
||||
sound_notifications = true,
|
||||
unreadcolorenable = true,
|
||||
cccolorenable = true,
|
||||
defaultsortfield = 3,
|
||||
|
|
|
@ -37,7 +37,8 @@ function mail.show_about(name)
|
|||
[[#FFF,NatureFreshMilk,Maintenance,]] ..
|
||||
[[#FFF,imre84,UI fixes,]] ..
|
||||
[[#FFF,Chache,Spanish translation,]] ..
|
||||
[[#FFF,APercy,Brazilian Portuguese trans.]
|
||||
[[#FFF,APercy,Brazilian Portuguese trans.,]] ..
|
||||
[[#FFF,bennstir,mail_notif.ogg]
|
||||
]] .. mail.theme
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
|
|
|
@ -17,6 +17,8 @@ function mail.show_settings(name)
|
|||
tostring(mail.get_setting(name, "onjoin_notifications")) .. [[]
|
||||
checkbox[0,2.0;hud_notifications;]] .. S("HUD notifications") .. [[;]] ..
|
||||
tostring(mail.get_setting(name, "hud_notifications")) .. [[]
|
||||
checkbox[0,2.4;sound_notifications;]] .. S("Sound notifications") .. [[;]] ..
|
||||
tostring(mail.get_setting(name, "sound_notifications")) .. [[]
|
||||
|
||||
box[5,0.8;3,0.45;#466432]
|
||||
label[5.2,0.8;]] .. S("Message list") .. [[]
|
||||
|
@ -68,6 +70,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
elseif fields.hud_notifications then
|
||||
mail.selected_idxs.hud_notifications[playername] = fields.hud_notifications == "true"
|
||||
|
||||
elseif fields.sound_notifications then
|
||||
mail.selected_idxs.sound_notifications[playername] = fields.sound_notifications == "true"
|
||||
|
||||
elseif fields.unreadcolorenable then
|
||||
mail.selected_idxs.unreadcolorenable[playername] = fields.unreadcolorenable == "true"
|
||||
|
||||
|
@ -79,6 +84,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
mail.set_setting(playername, "chat_notifications", mail.selected_idxs.chat_notifications[playername])
|
||||
mail.set_setting(playername, "onjoin_notifications", mail.selected_idxs.onjoin_notifications[playername])
|
||||
mail.set_setting(playername, "hud_notifications", mail.selected_idxs.hud_notifications[playername])
|
||||
mail.set_setting(playername, "sound_notifications", mail.selected_idxs.sound_notifications[playername])
|
||||
mail.set_setting(playername, "unreadcolorenable", mail.selected_idxs.unreadcolorenable[playername])
|
||||
mail.set_setting(playername, "cccolorenable", mail.selected_idxs.cccolorenable[playername])
|
||||
-- dropdowns
|
||||
|
|
Loading…
Add table
Reference in a new issue