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 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, "chatnotif") == 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)
end end
local receiver_entry = mail.get_storage_entry(name) local receiver_entry = mail.get_storage_entry(name)

View file

@ -48,7 +48,7 @@ function mail.hud_update(playername, messages)
end end
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.imageid, "text", "")
player:hud_change(data.textid, "text", "") player:hud_change(data.textid, "text", "")
else else

View file

@ -12,7 +12,7 @@ minetest.register_on_joinplayer(function(player)
end end
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.chat_send_player(name,
minetest.colorize("#00f529", "(" .. unreadcount .. ") You have mail! Type /mail to read")) minetest.colorize("#00f529", "(" .. unreadcount .. ") You have mail! Type /mail to read"))
end end

View file

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

View file

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