mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-06-29 14:50:41 +02:00
add I3 support + update to formspecs v2 (#22)
* add fs helper inv function * add fs helper prepends function * add trash can, vacuum tube, teleport tube. wielders, autocrafter, mesetube, injectors * fixed missed texture to make game agnostic * fix luacheck
This commit is contained in:
49
common.lua
49
common.lua
@ -143,6 +143,55 @@ function fs_helpers.cycling_button(meta, base, meta_name, values)
|
||||
return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text)..(addopts and ";"..addopts or "").."]"
|
||||
end
|
||||
|
||||
function fs_helpers.get_inv(y)
|
||||
local fs = {}
|
||||
if minetest.get_modpath("i3") then
|
||||
local inv_x = i3.settings.legacy_inventory and 0.75 or 0.22
|
||||
local inv_y = (y + 0.4) or 6.9
|
||||
local size, spacing = 1, 0.1
|
||||
local hotbar_len = i3.settings.hotbar_len
|
||||
|
||||
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, (i3.settings.legacy_inventory and 7 or 8) 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..","..(i3.settings.inv_size / hotbar_len)..";"..hotbar_len.."]")
|
||||
else
|
||||
table.insert(fs, "list[current_player;main;0.22,"..y..";8,4;]")
|
||||
end
|
||||
|
||||
return table.concat(fs, "")
|
||||
end
|
||||
|
||||
function fs_helpers.get_prepends(size)
|
||||
local prepend = {}
|
||||
|
||||
if minetest.get_modpath("i3") then
|
||||
prepend = {
|
||||
"no_prepend[]",
|
||||
"bgcolor[black;neither]",
|
||||
"background9[0,0;"..size..";i3_bg_full.png;false;10]",
|
||||
"style_type[button;border=false;bgimg=[combine:16x16^[noalpha^[colorize:#6b6b6b]",
|
||||
"listcolors[#0000;#ffffff20]"
|
||||
}
|
||||
end
|
||||
|
||||
return table.concat(prepend, "")
|
||||
end
|
||||
|
||||
---------
|
||||
-- Env --
|
||||
---------
|
||||
|
Reference in New Issue
Block a user