furniture/formspecs.lua

73 lines
2.2 KiB
Lua

local esc = minetest.formspec_escape
local title, text = '', ''
function furniture.storage_24_form(pos, name)
local meta = minetest.get_meta(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local existing_name = meta:get_string('infotext')
name = name or existing_name
local formspec =
'size[8,7.75]'..
'list[nodemeta:'..spos..';main;0,0;8,3;]'..
'field[1.3,3.3;2,1;description;;'..name..']'..
'button[3,3;1,1;save;Save]'..
'button[4,3;1,1;sort;Sort]'..
'list[current_player;main;0,4;8,4;]'..
'listring[]'
return formspec
end
function furniture.storage_32_form(pos, name)
local meta = minetest.get_meta(pos)
local existing_name = meta:get_string('infotext')
name = name or existing_name
local formspec =
'size[8,8.75]'..
'list[current_name;main;0,0;8,4;]'..
'field[1.3,4.3;2,1;description;;'..name..']'..
'button[3,4;1,1;save;Save]'..
'button[4,4;1,1;sort;Sort]'..
'list[current_player;main;0,5;8,4;]'..
'listring[]'
return formspec
end
function furniture.storage_60_form(pos, name)
local meta = minetest.get_meta(pos)
local existing_name = meta:get_string('infotext')
name = name or existing_name
local formspec =
'size[10,10.75]'..
'list[current_name;main;0,0;10,6;]'..
'field[2.3,6.3;2,1;description;;'..name..']'..
'button[4,6;1,1;save;Save]'..
'button[5,6;1,1;sort;Sort]'..
'list[current_player;main;1,7;8,4;]'..
'listring[]'
return formspec
end
local lectern_formspec =
'size[11,8]'..
'no_prepend[]'..
'bgcolor[#080808BB;true]'..
'background[0,0;11,8;furniture_lectern_formspec.png]'
function furniture.lectern_edit_sign(title, content)
local formspec =
lectern_formspec..
"field[0.5,1;7.5,0;title;"..esc("Title:")..";"..esc(title) .. "]" ..
"label[0.25,1.1;Body:]"..
"textarea[0.5,1.5;10.6,5.5;content;;"..esc(content).."]" ..
"button_exit[4,6.5;4,1;save;Save]"
return formspec
end
function furniture.lectern_view_sign(title, content)
local formspec =
lectern_formspec..
'hypertext[0,0;11,1;;<center><style color=black size=40>'..esc(title)..'</style></center>]'..
"textarea[0.5,1.5;10.6,6.5;;;"..esc(content).."]"
return formspec
end