meshes.lua 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. -- Meshes
  2. local S = minetest.get_translator("testnodes")
  3. local ocorner_cbox = {
  4. type = "fixed",
  5. fixed = {
  6. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  7. {-0.5, -0.25, -0.25, 0.25, 0, 0.5},
  8. {-0.5, 0, 0, 0, 0.25, 0.5},
  9. {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
  10. }
  11. }
  12. local tall_pyr_cbox = {
  13. type = "fixed",
  14. fixed = {
  15. { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
  16. { -0.375, -0.25, -0.375, 0.375, 0, 0.375},
  17. { -0.25, 0, -0.25, 0.25, 0.25, 0.25},
  18. { -0.125, 0.25, -0.125, 0.125, 0.5, 0.125}
  19. }
  20. }
  21. -- Normal mesh
  22. minetest.register_node("testnodes:mesh", {
  23. description = S("Mesh Test Node"),
  24. drawtype = "mesh",
  25. mesh = "testnodes_pyramid.obj",
  26. tiles = {"testnodes_mesh_stripes2.png"},
  27. paramtype = "light",
  28. collision_box = tall_pyr_cbox,
  29. groups = {dig_immediate=3},
  30. })
  31. -- Facedir mesh: outer corner slope
  32. minetest.register_node("testnodes:mesh_facedir", {
  33. description = S("Facedir Mesh Test Node").."\n"..
  34. S("param2 = facedir rotation (0..23)"),
  35. drawtype = "mesh",
  36. mesh = "testnodes_ocorner.obj",
  37. tiles = {"testnodes_mesh_stripes.png"},
  38. paramtype = "light",
  39. paramtype2 = "facedir",
  40. collision_box = ocorner_cbox,
  41. groups = {dig_immediate=3},
  42. })
  43. minetest.register_node("testnodes:mesh_colorfacedir", {
  44. description = S("Color Facedir Mesh Test Node").."\n"..
  45. S("param2 = color + facedir rotation (0..23, 32..55, ...)"),
  46. drawtype = "mesh",
  47. mesh = "testnodes_ocorner.obj",
  48. tiles = {"testnodes_mesh_stripes3.png"},
  49. paramtype = "light",
  50. paramtype2 = "colorfacedir",
  51. palette = "testnodes_palette_facedir.png",
  52. collision_box = ocorner_cbox,
  53. groups = {dig_immediate=3},
  54. })
  55. minetest.register_node("testnodes:mesh_4dir", {
  56. description = S("4dir Mesh Test Node").."\n"..
  57. S("param2 = 4dir rotation (0..3)"),
  58. drawtype = "mesh",
  59. mesh = "testnodes_ocorner.obj",
  60. tiles = {"testnodes_mesh_stripes5.png"},
  61. paramtype = "light",
  62. paramtype2 = "4dir",
  63. collision_box = ocorner_cbox,
  64. groups = {dig_immediate=3},
  65. })
  66. minetest.register_node("testnodes:mesh_color4dir", {
  67. description = S("Color 4dir Mesh Test Node").."\n"..
  68. S("param2 = color + 4dir rotation (0..255)"),
  69. drawtype = "mesh",
  70. mesh = "testnodes_ocorner.obj",
  71. tiles = {"testnodes_mesh_stripes6.png"},
  72. paramtype = "light",
  73. paramtype2 = "color4dir",
  74. palette = "testnodes_palette_4dir.png",
  75. collision_box = ocorner_cbox,
  76. groups = {dig_immediate=3},
  77. })
  78. -- Wallmounted mesh: pyramid
  79. minetest.register_node("testnodes:mesh_wallmounted", {
  80. description = S("Wallmounted Mesh Test Node").."\n"..
  81. S("param2 = wallmounted rotation (0..7)"),
  82. drawtype = "mesh",
  83. mesh = "testnodes_pyramid.obj",
  84. tiles = {"testnodes_mesh_stripes9.png"},
  85. paramtype = "light",
  86. paramtype2 = "wallmounted",
  87. collision_box = tall_pyr_cbox,
  88. groups = {dig_immediate=3},
  89. })
  90. minetest.register_node("testnodes:mesh_colorwallmounted", {
  91. description = S("Color Wallmounted Mesh Test Node").."\n"..
  92. S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
  93. drawtype = "mesh",
  94. mesh = "testnodes_pyramid.obj",
  95. tiles = {"testnodes_mesh_stripes10.png"},
  96. paramtype = "light",
  97. paramtype2 = "colorwallmounted",
  98. palette = "testnodes_palette_wallmounted.png",
  99. collision_box = tall_pyr_cbox,
  100. groups = {dig_immediate=3},
  101. })
  102. minetest.register_node("testnodes:mesh_double", {
  103. description = S("Double-sized Mesh Test Node"),
  104. drawtype = "mesh",
  105. mesh = "testnodes_pyramid.obj",
  106. tiles = {"testnodes_mesh_stripes2.png"},
  107. paramtype = "light",
  108. collision_box = tall_pyr_cbox,
  109. visual_scale = 2,
  110. groups = {dig_immediate=3},
  111. })
  112. minetest.register_node("testnodes:mesh_half", {
  113. description = S("Half-sized Mesh Test Node"),
  114. drawtype = "mesh",
  115. mesh = "testnodes_pyramid.obj",
  116. tiles = {"testnodes_mesh_stripes2.png"},
  117. paramtype = "light",
  118. collision_box = tall_pyr_cbox,
  119. visual_scale = 0.5,
  120. groups = {dig_immediate=3},
  121. })
  122. minetest.register_node("testnodes:mesh_waving1", {
  123. description = S("Plantlike-waving Mesh Test Node").."\n"..
  124. S("Waves if waving plants are enabled by client"),
  125. drawtype = "mesh",
  126. mesh = "testnodes_pyramid.obj",
  127. tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"},
  128. paramtype = "light",
  129. collision_box = tall_pyr_cbox,
  130. waving = 1,
  131. groups = {dig_immediate=3},
  132. })
  133. minetest.register_node("testnodes:mesh_waving2", {
  134. description = S("Leaflike-waving Mesh Test Node").."\n"..
  135. S("Waves if waving leaves are enabled by client"),
  136. drawtype = "mesh",
  137. mesh = "testnodes_pyramid.obj",
  138. tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"},
  139. paramtype = "light",
  140. collision_box = tall_pyr_cbox,
  141. waving = 2,
  142. groups = {dig_immediate=3},
  143. })
  144. minetest.register_node("testnodes:mesh_waving3", {
  145. description = S("Liquidlike-waving Mesh Test Node").."\n"..
  146. S("Waves if waving liquids are enabled by client"),
  147. drawtype = "mesh",
  148. mesh = "testnodes_pyramid.obj",
  149. tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"},
  150. paramtype = "light",
  151. collision_box = tall_pyr_cbox,
  152. waving = 3,
  153. groups = {dig_immediate=3},
  154. })