1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-11-15 23:10:33 +01:00

make prepends a function

This commit is contained in:
unknown 2022-04-13 22:41:07 -04:00
parent c188a18cba
commit 9bd59c9f51
3 changed files with 16 additions and 12 deletions

View File

@ -169,6 +169,16 @@ function fs_helpers.get_inv(y)
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]"
end
return prepend
end
---------
-- Env --
---------

View File

@ -20,14 +20,11 @@ minetest.register_node("pipeworks:trashcan", {
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local prepend = ""
if minetest.get_modpath("i3") then
prepend = "no_prepend[]bgcolor[black;neither]background9[0,0;10.2,9;i3_bg_full.png;false;10]"
end
local size = "10.2,9"
meta:set_string("formspec",
"formspec_version[2]" ..
"size[10.2,9]"..
prepend ..
"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[context;trash;4.5,2;1,1;]"..

View File

@ -39,14 +39,11 @@ if pipeworks.enable_mese_sand_tube then
groups = {vacuum_tube = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local size = "6.0,2.4"
meta:set_int("dist", 0)
local prepend = ""
if minetest.get_modpath("i3") then
prepend = "no_prepend[]bgcolor[black;neither]background9[0,0;6.0,2.2;i3_bg_full.png;false;10]"
end
meta:set_string("formspec",
"size[6.0,2.2]"..
prepend ..
"size["..size.."]"..
pipeworks.fs_helpers.get_prepends(size) ..
"image[0.2,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
"label[1.2,0.2;"..S("Adjustable Vacuuming Tube").."]"..
"field[0.5,1.6;2.1,1;dist;"..S("Radius")..";${dist}]"..