Better settings names

This commit is contained in:
Athozus 2023-05-04 18:37:57 +02:00
parent e7fffbea2e
commit 61f3eb6222
No known key found for this signature in database
GPG key ID: B50895022E8484BF
5 changed files with 21 additions and 21 deletions

View file

@ -98,7 +98,7 @@ function mail.send(m)
for _, player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if recipients[name] then
if mail.get_setting(name, "chatnotif") == true then
if mail.get_setting(name, "chat_notifications") == true then
minetest.chat_send_player(name, mail_alert)
end
local receiver_entry = mail.get_storage_entry(name)

View file

@ -48,7 +48,7 @@ function mail.hud_update(playername, messages)
end
end
if unreadcount == 0 or (not mail.get_setting(playername, "hudnotif")) then
if unreadcount == 0 or (not mail.get_setting(playername, "hud_notifications")) then
player:hud_change(data.imageid, "text", "")
player:hud_change(data.textid, "text", "")
else

View file

@ -12,7 +12,7 @@ minetest.register_on_joinplayer(function(player)
end
end
if unreadcount > 0 and mail.get_setting(name, "onjoinnotif") then
if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then
minetest.chat_send_player(name,
minetest.colorize("#00f529", "(" .. unreadcount .. ") You have mail! Type /mail to read"))
end

View file

@ -249,9 +249,9 @@ end
function mail.get_setting_default_value(setting_name)
local default_values = {
chatnotif = true,
onjoinnotif = true,
hudnotif = true,
chat_notifications = true,
onjoin_notifications = true,
hud_notifications = true,
unreadcolorenable = true,
cccolorenable = true,
defaultsortfield = 3,

View file

@ -11,12 +11,12 @@ function mail.show_settings(name)
box[0,0.8;3,0.45;#466432]
label[0.2,0.8;]] .. S("Notifications") .. [[]
checkbox[0,1.2;chatnotif;]] .. S("Chat notifications") .. [[;]] ..
tostring(mail.get_setting(name, "chatnotif")) .. [[]
checkbox[0,1.6;onjoinnotif;]] .. S("On join notifications") .. [[;]] ..
tostring(mail.get_setting(name, "onjoinnotif")) .. [[]
checkbox[0,2.0;hudnotif;]] .. S("HUD notifications") .. [[;]] ..
tostring(mail.get_setting(name, "hudnotif")) .. [[]
checkbox[0,1.2;chat_notifications;]] .. S("Chat notifications") .. [[;]] ..
tostring(mail.get_setting(name, "chat_notifications")) .. [[]
checkbox[0,1.6;onjoin_notifications;]] .. S("On join notifications") .. [[;]] ..
tostring(mail.get_setting(name, "onjoin_notifications")) .. [[]
checkbox[0,2.0;hud_notifications;]] .. S("HUD notifications") .. [[;]] ..
tostring(mail.get_setting(name, "hud_notifications")) .. [[]
box[5,0.8;3,0.45;#466432]
label[5.2,0.8;]] .. S("Message list") .. [[]
@ -72,24 +72,24 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
mail.show_about(playername)
return
elseif fields.chatnotif then
elseif fields.chat_notifications then
local setting = {
name = "chatnotif",
value = fields.chatnotif == "true",
name = "chat_notifications",
value = fields.chat_notifications == "true",
}
mail.set_setting(playername, setting)
elseif fields.onjoinnotif then
elseif fields.onjoin_notifications then
local setting = {
name = "onjoinnotif",
value = fields.onjoinnotif == "true",
name = "onjoin_notifications",
value = fields.onjoin_notifications == "true",
}
mail.set_setting(playername, setting)
elseif fields.hudnotif then
elseif fields.hud_notifications then
local setting = {
name = "hudnotif",
value = fields.hudnotif == "true",
name = "hud_notifications",
value = fields.hud_notifications == "true",
}
mail.set_setting(playername, setting)
mail.hud_update(playername, mail.get_storage_entry(playername).inbox)