mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-15 23:10:33 +01:00
add wielders, bugfix prepends, bugfix list styling
This commit is contained in:
parent
0345386323
commit
bf885e4b57
19
common.lua
19
common.lua
|
@ -160,6 +160,13 @@ function fs_helpers.get_inv(y)
|
|||
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
|
||||
|
@ -170,13 +177,19 @@ function fs_helpers.get_inv(y)
|
|||
end
|
||||
|
||||
function fs_helpers.get_prepends(size)
|
||||
local prepend = ""
|
||||
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]"
|
||||
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 prepend
|
||||
return table.concat(prepend, "")
|
||||
end
|
||||
|
||||
---------
|
||||
|
|
|
@ -21,12 +21,17 @@ minetest.register_node("pipeworks:trashcan", {
|
|||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local size = "10.2,9"
|
||||
local list_background = ""
|
||||
if minetest.get_modpath("i3") then
|
||||
list_background = "style_type[box;colors=#666]box[4.5,2;1,1;]"
|
||||
end
|
||||
meta:set_string("formspec",
|
||||
"formspec_version[2]" ..
|
||||
"size["..size.."]"..
|
||||
pipeworks.fs_helpers.get_prepends(size) ..
|
||||
"item_image[0.5,0.5;1,1;pipeworks:trashcan]"..
|
||||
"label[1.5,1;"..S("Trash Can").."]"..
|
||||
list_background..
|
||||
"list[context;trash;4.5,2;1,1;]"..
|
||||
--"list[current_player;main;0,3;8,4;]" ..
|
||||
pipeworks.fs_helpers.get_inv(4)..
|
||||
|
|
27
wielder.lua
27
wielder.lua
|
@ -6,13 +6,28 @@ local function delay(x)
|
|||
end
|
||||
|
||||
local function set_wielder_formspec(data, meta)
|
||||
local size = "10.2,"..(7+data.wield_inv_height)
|
||||
local list_background = ""
|
||||
if minetest.get_modpath("i3") then
|
||||
list_background = "style_type[box;colors=#666]"
|
||||
for i=0, data.wield_inv_height-1 do
|
||||
for j=0, data.wield_inv_width-1 do
|
||||
list_background = list_background .. "box[".. ((10-data.wield_inv_width)*0.5)+(i*1.25) ..",".. 1+(j*1.25) ..";1,1;]"
|
||||
end
|
||||
end
|
||||
end
|
||||
meta:set_string("formspec",
|
||||
"size[8,"..(6+data.wield_inv_height)..";]"..
|
||||
"item_image[0,0;1,1;"..data.name_base.."_off]"..
|
||||
"label[1,0;"..minetest.formspec_escape(data.description).."]"..
|
||||
"list[current_name;"..minetest.formspec_escape(data.wield_inv_name)..";"..((8-data.wield_inv_width)*0.5)..",1;"..data.wield_inv_width..","..data.wield_inv_height..";]"..
|
||||
"list[current_player;main;0,"..(2+data.wield_inv_height)..";8,4;]" ..
|
||||
"listring[]")
|
||||
"formspec_version[2]" ..
|
||||
"size["..size.."]"..
|
||||
pipeworks.fs_helpers.get_prepends(size)..
|
||||
"item_image[0.5,0.5;1,1;"..data.name_base.."_off]"..
|
||||
"label[1.5,1;"..minetest.formspec_escape(data.description).."]"..
|
||||
list_background ..
|
||||
"list[current_name;"..minetest.formspec_escape(data.wield_inv_name)..";"..((10-data.wield_inv_width)*0.5)..",1;"..data.wield_inv_width..","..data.wield_inv_height..";]"..
|
||||
pipeworks.fs_helpers.get_inv((2+data.wield_inv_height))
|
||||
--"list[current_player;main;0,"..(2+data.wield_inv_height)..";8,4;]" ..
|
||||
--"listring[]"
|
||||
)
|
||||
meta:set_string("infotext", data.description)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user