From 61f3eb6222ec759414178077bf5b1a182e66850c Mon Sep 17 00:00:00 2001 From: Athozus Date: Thu, 4 May 2023 18:37:57 +0200 Subject: [PATCH] Better settings names --- api.lua | 2 +- hud.lua | 2 +- onjoin.lua | 2 +- storage.lua | 6 +++--- ui/settings.lua | 30 +++++++++++++++--------------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/api.lua b/api.lua index 495ab45..61b074f 100644 --- a/api.lua +++ b/api.lua @@ -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) diff --git a/hud.lua b/hud.lua index 66119f3..7eca2a2 100644 --- a/hud.lua +++ b/hud.lua @@ -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 diff --git a/onjoin.lua b/onjoin.lua index 4230e65..c6d59db 100644 --- a/onjoin.lua +++ b/onjoin.lua @@ -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 diff --git a/storage.lua b/storage.lua index 4f64882..93efbe0 100644 --- a/storage.lua +++ b/storage.lua @@ -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, diff --git a/ui/settings.lua b/ui/settings.lua index acaa41f..65b90ff 100644 --- a/ui/settings.lua +++ b/ui/settings.lua @@ -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)