nodeboxes.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. local S = minetest.get_translator("testnodes")
  2. -- Nodebox examples and tests.
  3. -- An simple example nodebox with one centered box
  4. minetest.register_node("testnodes:nodebox_fixed", {
  5. description = S("Fixed Nodebox Test Node"),
  6. tiles = {"testnodes_nodebox.png"},
  7. drawtype = "nodebox",
  8. paramtype = "light",
  9. node_box = {
  10. type = "fixed",
  11. fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
  12. },
  13. groups = {dig_immediate=3},
  14. })
  15. -- 50% higher than a regular node
  16. minetest.register_node("testnodes:nodebox_overhigh", {
  17. description = S("+50% high Nodebox Test Node"),
  18. tiles = {"testnodes_nodebox.png"},
  19. drawtype = "nodebox",
  20. paramtype = "light",
  21. node_box = {
  22. type = "fixed",
  23. fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5},
  24. },
  25. groups = {dig_immediate=3},
  26. })
  27. -- 95% higher than a regular node
  28. minetest.register_node("testnodes:nodebox_overhigh2", {
  29. description = S("+95% high Nodebox Test Node"),
  30. tiles = {"testnodes_nodebox.png"},
  31. drawtype = "nodebox",
  32. paramtype = "light",
  33. node_box = {
  34. type = "fixed",
  35. -- Y max: more is possible, but glitchy
  36. fixed = {-0.5, -0.5, -0.5, 0.5, 1.45, 0.5},
  37. },
  38. groups = {dig_immediate=3},
  39. })
  40. -- Height of nodebox changes with its param2 value
  41. minetest.register_node("testnodes:nodebox_leveled", {
  42. description = S("Leveled Nodebox Test Node"),
  43. tiles = {"testnodes_nodebox.png"},
  44. drawtype = "nodebox",
  45. paramtype = "light",
  46. paramtype2 = "leveled",
  47. node_box = {
  48. type = "leveled",
  49. fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5},
  50. },
  51. groups = {dig_immediate=3},
  52. })
  53. -- Wall-like nodebox that connects to neighbors
  54. minetest.register_node("testnodes:nodebox_connected", {
  55. description = S("Connected Nodebox Test Node"),
  56. tiles = {"testnodes_nodebox.png"},
  57. groups = {connected_nodebox=1, dig_immediate=3},
  58. drawtype = "nodebox",
  59. paramtype = "light",
  60. connects_to = {"group:connected_nodebox"},
  61. connect_sides = {"front", "back", "left", "right"},
  62. node_box = {
  63. type = "connected",
  64. fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125},
  65. connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125},
  66. connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500},
  67. connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125},
  68. connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125},
  69. },
  70. })