adapt visibility dialog to new style

Also button image locations are slightly adapted
This commit is contained in:
Dirk Sohler 2021-04-04 12:59:41 +02:00
parent fd7c3f67d3
commit 69dd2386c0
No known key found for this signature in database
GPG Key ID: B9751241BD7D4E1A
10 changed files with 16 additions and 7 deletions

@ -18,9 +18,12 @@ Custom Timer=Individueller Timer
Visibility=Sichtbarkeit Visibility=Sichtbarkeit
mTimer Configuration=mTimer-Konfiguration mTimer Configuration=mTimer-Konfiguration
# Settings # Visibility
Invisible=Unsichtbar Make invisible=Verbergen
Visible=Sichtbar Make visible=Anzeigen
The timer is currently @1.=Der Timer ist aktuell @1.
visible=sichtbar
invisible=verborgen
# Information & Warnings # Information & Warnings
30 minutes @= 0.5, 60 minutes @= 1=30 Minuten @= 0.5, 60 Minuten @= 1 30 minutes @= 0.5, 60 minutes @= 1=30 Minuten @= 0.5, 60 Minuten @= 1

@ -25,12 +25,17 @@ local esc = minetest.formspec_escape
mtimer.dialog.set_visibility = function (player_name) 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', { mtimer.show_formspec('mtimer:set_visibility', {
title = S('Visibility'), title = S('Visibility'),
show_to = player_name, show_to = player_name,
formspec = { formspec = {
'button[0,0;3,0.5;visible;'..S('Visible')..']', mtimer.get_icon_button('set_visible', { width = 4, label = S('Make visible') }),
'button[3.25,0;3,0.5;invisible;'..S('Invisible')..']' 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 end

@ -36,9 +36,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- Set timer visibility -- Set timer visibility
if formname == 'mtimer:set_visibility' then if formname == 'mtimer:set_visibility' then
local attr = m.meta.visible local attr = m.meta.visible
if fields.visible then meta:set_string(attr.key, 'true') end if fields.set_visible then meta:set_string(attr.key, 'true') end
if fields.invisible then meta:set_string(attr.key, 'false') 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 fields.default then meta:set_string(attr.key, attr.default) end
if not fields.quit then d.set_visibility(name) end
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB