diff --git a/locale/mtimer.de.tr b/locale/mtimer.de.tr index e42547f..643af8f 100644 --- a/locale/mtimer.de.tr +++ b/locale/mtimer.de.tr @@ -18,9 +18,12 @@ Custom Timer=Individueller Timer Visibility=Sichtbarkeit mTimer Configuration=mTimer-Konfiguration -# Settings -Invisible=Unsichtbar -Visible=Sichtbar +# Visibility +Make invisible=Verbergen +Make visible=Anzeigen +The timer is currently @1.=Der Timer ist aktuell @1. +visible=sichtbar +invisible=verborgen # Information & Warnings 30 minutes @= 0.5, 60 minutes @= 1=30 Minuten @= 0.5, 60 Minuten @= 1 diff --git a/system/formspecs/formspec_creation.lua b/system/formspecs/formspec_creation.lua index 419f3e9..5603679 100644 --- a/system/formspecs/formspec_creation.lua +++ b/system/formspecs/formspec_creation.lua @@ -25,12 +25,17 @@ local esc = minetest.formspec_escape mtimer.dialog.set_visibility = function (player_name) + local player = minetest.get_player_by_name(player_name) + local visible = player:get_meta():get_string(m.meta.visible.key) + local timer_status = visible == 'true' and S('visible') or S('invisible') + mtimer.show_formspec('mtimer:set_visibility', { title = S('Visibility'), show_to = player_name, formspec = { - 'button[0,0;3,0.5;visible;'..S('Visible')..']', - 'button[3.25,0;3,0.5;invisible;'..S('Invisible')..']' + mtimer.get_icon_button('set_visible', { width = 4, label = S('Make visible') }), + mtimer.get_icon_button('set_invisible', { width = 4, label = S('Make invisible'), container = { left = 4.25 } }), + 'label[0,1.25;'..S('The timer is currently @1.', timer_status)..']' } }) end diff --git a/system/on_receive_fields.lua b/system/on_receive_fields.lua index 2a2842e..51ffcc9 100644 --- a/system/on_receive_fields.lua +++ b/system/on_receive_fields.lua @@ -36,9 +36,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) -- Set timer visibility if formname == 'mtimer:set_visibility' then local attr = m.meta.visible - if fields.visible then meta:set_string(attr.key, 'true') end - if fields.invisible then meta:set_string(attr.key, 'false') end + if fields.set_visible then meta:set_string(attr.key, 'true') end + if fields.set_invisible then meta:set_string(attr.key, 'false') end if fields.default then meta:set_string(attr.key, attr.default) end + if not fields.quit then d.set_visibility(name) end end diff --git a/textures/buttons/actions/mtimer_set_invisible.png b/textures/buttons/actions/mtimer_set_invisible.png new file mode 100644 index 0000000..6efb603 Binary files /dev/null and b/textures/buttons/actions/mtimer_set_invisible.png differ diff --git a/textures/buttons/actions/mtimer_set_visible.png b/textures/buttons/actions/mtimer_set_visible.png new file mode 100644 index 0000000..3b11745 Binary files /dev/null and b/textures/buttons/actions/mtimer_set_visible.png differ diff --git a/textures/buttons/mtimer_apply.png b/textures/buttons/dialog/mtimer_apply.png similarity index 100% rename from textures/buttons/mtimer_apply.png rename to textures/buttons/dialog/mtimer_apply.png diff --git a/textures/buttons/mtimer_default.png b/textures/buttons/dialog/mtimer_default.png similarity index 100% rename from textures/buttons/mtimer_default.png rename to textures/buttons/dialog/mtimer_default.png diff --git a/textures/buttons/mtimer_exit.png b/textures/buttons/dialog/mtimer_exit.png similarity index 100% rename from textures/buttons/mtimer_exit.png rename to textures/buttons/dialog/mtimer_exit.png diff --git a/textures/buttons/mtimer_reset_everything.png b/textures/buttons/dialog/mtimer_reset_everything.png similarity index 100% rename from textures/buttons/mtimer_reset_everything.png rename to textures/buttons/dialog/mtimer_reset_everything.png diff --git a/textures/icons/mtimer_set_visibility.png b/textures/icons/mtimer_set_visibility.png index eb36b63..c46c69f 100644 Binary files a/textures/icons/mtimer_set_visibility.png and b/textures/icons/mtimer_set_visibility.png differ