diff --git a/system/formspecs/formspec_creation.lua b/system/formspecs/formspec_creation.lua index 7ec792a..1e86b0b 100644 --- a/system/formspecs/formspec_creation.lua +++ b/system/formspecs/formspec_creation.lua @@ -8,6 +8,7 @@ local m = mtimer local S = m.translator local esc = minetest.formspec_escape +local line = mtimer.get_table_line -- Formspecs are loaded and shown by individual functions. The function name @@ -82,7 +83,6 @@ end mtimer.dialog.ingame_time_format = function (player_name) local time_data = mtimer.get_times(player_name).ingame_time - local line = mtimer.get_table_line mtimer.show_formspec('mtimer:ingame_time_format', { title = S('Ingame Time Format'), @@ -138,21 +138,18 @@ mtimer.dialog.session_duration_format = function (player_name) mtimer.show_formspec('mtimer:session_duration_format', { title = S('Session Duration Format'), show_to = player_name, - height = 3.8, formspec = { 'field_close_on_enter[format;false]', 'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']', - 'container[0,0.9]', - 'label[2.5,0;'..S('Variable')..']', - 'label[4,0;'..S('Current Value')..']', - 'box[0,0.25;+contentWidth,0.02;#ffffff]', - 'label[0,0.5;'..S('Days')..'] label[2.5,0.5;{days}] label[4,0.5;'..time_data.days..']', - 'label[0,0.9;'..S('Hours')..'] label[2.5,0.9;{hours}] label[4,0.9;'..time_data.hours..']', - 'label[0,1.3;'..S('Minutes')..'] label[2.5,1.3;{minutes}] label[4,1.3;'..time_data.minutes..']', - 'label[0,1.7;'..S('Seconds')..'] label[2.5,1.7;{seconds}] label[4,1.7;'..time_data.seconds..']', - 'box[0,2;+contentWidth,0.02;#ffffff]', - 'label[0,2.25;'..S('Current Result')..']', - 'label[2.5,2.25;'..esc(time_data.formatted)..']', + 'container[0,1.5]', + line(0, '', S('Variable'), S('Current Value')), + line(1, '-'), + line(2, S('Days'), '{days}', time_data.days), + line(3, S('Hours'), '{hours}', time_data.hours), + line(4, S('Minutes'), '{minutes}', time_data.minutes), + line(5, S('Seconds'), '{seconds}', time_data.seconds), + line(6, '-'), + line(7, S('Current Result'), esc(time_data.formatted), ''), 'container_end[]' } })