formspecs.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. local esc = minetest.formspec_escape
  2. local title, text = '', ''
  3. function furniture.storage_24_form(pos, name)
  4. local meta = minetest.get_meta(pos)
  5. local spos = pos.x .. "," .. pos.y .. "," .. pos.z
  6. local existing_name = meta:get_string('infotext')
  7. name = name or existing_name
  8. local formspec =
  9. 'size[8,7.75]'..
  10. 'list[nodemeta:'..spos..';main;0,0;8,3;]'..
  11. 'field[1.3,3.3;2,1;description;;'..name..']'..
  12. 'button[3,3;1,1;save;Save]'..
  13. 'button[4,3;1,1;sort;Sort]'..
  14. 'list[current_player;main;0,4;8,4;]'..
  15. 'listring[]'
  16. return formspec
  17. end
  18. function furniture.storage_32_form(pos, name)
  19. local meta = minetest.get_meta(pos)
  20. local existing_name = meta:get_string('infotext')
  21. name = name or existing_name
  22. local formspec =
  23. 'size[8,8.75]'..
  24. 'list[current_name;main;0,0;8,4;]'..
  25. 'field[1.3,4.3;2,1;description;;'..name..']'..
  26. 'button[3,4;1,1;save;Save]'..
  27. 'button[4,4;1,1;sort;Sort]'..
  28. 'list[current_player;main;0,5;8,4;]'..
  29. 'listring[]'
  30. return formspec
  31. end
  32. function furniture.storage_60_form(pos, name)
  33. local meta = minetest.get_meta(pos)
  34. local existing_name = meta:get_string('infotext')
  35. name = name or existing_name
  36. local formspec =
  37. 'size[10,10.75]'..
  38. 'list[current_name;main;0,0;10,6;]'..
  39. 'field[2.3,6.3;2,1;description;;'..name..']'..
  40. 'button[4,6;1,1;save;Save]'..
  41. 'button[5,6;1,1;sort;Sort]'..
  42. 'list[current_player;main;1,7;8,4;]'..
  43. 'listring[]'
  44. return formspec
  45. end
  46. local lectern_formspec =
  47. 'size[11,8]'..
  48. 'no_prepend[]'..
  49. 'bgcolor[#080808BB;true]'..
  50. 'background[0,0;11,8;furniture_lectern_formspec.png]'
  51. function furniture.lectern_edit_sign(title, content)
  52. local formspec =
  53. lectern_formspec..
  54. "field[0.5,1;7.5,0;title;"..esc("Title:")..";"..esc(title) .. "]" ..
  55. "label[0.25,1.1;Body:]"..
  56. "textarea[0.5,1.5;10.6,5.5;content;;"..esc(content).."]" ..
  57. "button_exit[4,6.5;4,1;save;Save]"
  58. return formspec
  59. end
  60. function furniture.lectern_view_sign(title, content)
  61. local formspec =
  62. lectern_formspec..
  63. 'hypertext[0,0;11,1;;<center><style color=black size=40>'..esc(title)..'</style></center>]'..
  64. "textarea[0.5,1.5;10.6,6.5;;;"..esc(content).."]"
  65. return formspec
  66. end