@@ -16,40 +16,42 @@ local bghiglight_lcd = "#5CAA77"
16
16
local textcolor = " #101010"
17
17
-- local bgcolor_button = "#626E41"
18
18
19
- local form_width = 7
19
+ local form_width = 8
20
+ local form_height = 11.5
20
21
local btn_count = 3
21
22
local btn_spacing = 0.1
22
23
local btn_width = (form_width - ((btn_count + 1 ) * btn_spacing )) / btn_count
23
24
24
25
local open_formspecs = {}
25
26
26
27
local formspec_escape = minetest .formspec_escape
27
- local function fmtf (n ) return ( " %0.3f" ):format (n ) end
28
+ local function fmtf (n ) return type ( n ) == " number " and ( " %0.3f" ):format (n ) or n end
28
29
local function fs_x_pos (i ) return (btn_spacing * i ) + (btn_width * (i - 1 )) end
29
30
local function create_button (index , y , h , name , label , exit , modifier )
30
31
local x = fs_x_pos (index )
31
32
local t1 = texture_button .. (modifier and formspec_escape (modifier ) or " " )
32
33
local t2 = texture_button_pressed .. (modifier and formspec_escape (modifier ) or " " )
33
- local dimensions = (" %s,%s;%s,%s" ):format (fmtf (x ),y ,fmtf (btn_width ),h )
34
+ local dimensions = (" %s,%s;%s,%s" ):format (fmtf (x ),fmtf ( y ) ,fmtf (btn_width ),h )
34
35
local properties = (" %s;%s;%s;false;false;%s" ):format (t1 , name , label , t2 )
35
36
return (" image_button%s[%s;%s]" ):format (exit and " _exit" or " " , dimensions , properties )
36
37
end
37
38
38
39
local formspec_format_string = " formspec_version[3]" ..
39
- (" size[%s,10;]bgcolor[%s;both;]" ):format (fmtf (form_width ),bgcolor ) ..
40
- (" style_type[*;textcolor=%s;font=mono]" ):format (textcolor ) ..
41
- (" style_type[label;textcolor=%s;font_size=*2;font=mono]" ):format (textcolor ) ..
42
- (" background9[0,0;%s,10;%s;false;3]" ):format (form_width , texture_bg9 ) ..
40
+ (" size[%s,%s;]bgcolor[%s;both;]" ):format (fmtf (form_width ), fmtf (form_height ), bgcolor ) ..
41
+ (" style_type[*;textcolor=%s;font_size=*1]" ):format (textcolor ) ..
42
+ (" style_type[table;textcolor=%s;font_size=*1;font=mono]" ):format (textcolor ) ..
43
+ (" style_type[label;textcolor=%s;font_size=*2]" ):format (textcolor ) ..
44
+ (" background9[0,0;%s,%s;%s;false;3]" ):format (fmtf (form_width ), fmtf (form_height ), texture_bg9 ) ..
43
45
(" image[0.3,0.3;5.75,1;%s]" ):format (texture_logo ) ..
44
46
" label[0.6,1.5;Network %s]" ..
45
47
(" field[%s,2.5;%s,0.8;net;Network ID:;%%s]" ):format (fmtf (fs_x_pos (2 )),fmtf (btn_width )) ..
46
48
create_button (3 , " 2.5" , " 0.8" , " rs" , " Remote start" , false , " ^[colorize:#10E010:125" ) ..
47
- create_button (1 , " 9.1 " , " 0.8" , " wp" , " Waypoint" , true ) ..
48
- create_button (2 , " 9.1 " , " 0.8" , " up" , " Update" , false ) ..
49
- create_button (3 , " 9.1 " , " 0.8" , " exit" , " Exit" , true ) ..
49
+ create_button (1 , form_height - 0.9 , " 0.8" , " wp" , " Waypoint" , true ) ..
50
+ create_button (2 , form_height - 0.9 , " 0.8" , " up" , " Update" , false ) ..
51
+ create_button (3 , form_height - 0.9 , " 0.8" , " exit" , " Exit" , true ) ..
50
52
(" tableoptions[border=false;background=%s;highlight=%s;color=%s]" ):format (bgcolor_lcd ,bghiglight_lcd ,textcolor ) ..
51
- " tablecolumns[indent;text,width=14 ;text,width=14 ;text,align=center]" ..
52
- (" table[0.1,3.4;%s,5.4 ;items;1,Property,Value,Unit%%s]" ):format (fmtf (form_width - 0.2 ))
53
+ " tablecolumns[indent,width=0.2 ;text,width=13 ;text,width=13 ;text,align=center]" ..
54
+ (" table[0.1,3.4;%s,%s ;items;1,Property,Value,Unit%%s]" ):format (fmtf (form_width - 0.2 ), fmtf ( form_height - 4.4 ))
53
55
54
56
minetest .register_craft ({
55
57
output = ' technic:multimeter' ,
0 commit comments