diff --git a/common.lua b/common.lua index 1161ba6..3a45e91 100644 --- a/common.lua +++ b/common.lua @@ -168,6 +168,31 @@ function fs_helpers.get_inv(y) end end + table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]") + table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]") + elseif minetest.get_modpath("mcl_formspec") then + local inv_x = 0.22 + local inv_y = (y + 0.4) or 6.9 + local size, spacing = 1, 0.1 + local hotbar_len = 9 + local inv_size = hotbar_len * 4 + + table.insert(fs, "style_type[box;colors=#77777710,#77777710,#777,#777]") + + for i = 0, hotbar_len - 1 do + table.insert(fs, "box["..(i * size + inv_x + (i * spacing))..","..inv_y..";"..size..","..size..";]") + end + + table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]") + table.insert(fs, "list[current_player;main;"..inv_x..","..inv_y..";"..hotbar_len..",1;]") + + table.insert(fs, "style_type[box;colors=#666]") + for i=0, 2 do + for j=0, hotbar_len - 1 do + table.insert(fs, "box["..0.2+(j*0.1)+(j*size)..","..(inv_y+size+spacing+0.05)+(i*0.1)+(i*size)..";"..size..","..size..";]") + end + end + table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]") table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(inv_size / hotbar_len)..";"..hotbar_len.."]") else