node_stairs.lua 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. local S = minetest.get_translator("building_blocks")
  2. local stairs_groups_names = {"cracky","choppy","flammable","crumbly","snappy"}
  3. local function building_blocks_stairs(nodename, def)
  4. minetest.register_node(nodename, def)
  5. if minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs") then
  6. local mod, name = nodename:match("(.*):(.*)")
  7. minetest.register_alias(mod .. ":slab_" .. name, "stairs:slab_" .. name)
  8. minetest.register_alias(mod .. ":stair_" .. name, "stairs:stair_" .. name)
  9. local stairs_groups = {}
  10. for _, groupname in ipairs(stairs_groups_names) do
  11. stairs_groups[groupname] = def.groups[groupname]
  12. end
  13. if minetest.get_modpath("moreblocks") then
  14. stairsplus:register_all(
  15. mod,
  16. name,
  17. nodename,
  18. {
  19. description = def.description,
  20. tiles = def.tiles,
  21. groups = stairs_groups,
  22. sounds = def.sounds,
  23. }
  24. )
  25. else
  26. stairs.register_stair_and_slab(name,nodename,
  27. stairs_groups,
  28. def.tiles,
  29. def.stair_desc,
  30. def.slab_desc,
  31. def.sounds
  32. --FIXME: Missing descriptions for Inner and Outer stairs
  33. -- See https://github.com/minetest/minetest_game/pull/2584
  34. )
  35. end
  36. end
  37. end
  38. building_blocks_stairs("building_blocks:grate", {
  39. drawtype = "glasslike",
  40. description = S("Grate"),
  41. stair_desc = S("Grate Stair"),
  42. slab = S("Grate Slab"),
  43. tiles = {"building_blocks_grate.png"},
  44. paramtype = "light",
  45. sunlight_propagates = true,
  46. is_ground_content = true,
  47. groups = {cracky=1},
  48. sounds = default.node_sound_metal_defaults(),
  49. })
  50. building_blocks_stairs("building_blocks:smoothglass", {
  51. drawtype = "glasslike",
  52. description = S("Streak Free Glass"),
  53. stair_desc = S("Streak Free Glass Stair"),
  54. slab_desc = S("Streak Free Glass Slab"),
  55. tiles = {"building_blocks_sglass.png"},
  56. paramtype = "light",
  57. sunlight_propagates = true,
  58. is_ground_content = true,
  59. groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3},
  60. sounds = default.node_sound_glass_defaults(),
  61. })
  62. building_blocks_stairs("building_blocks:woodglass", {
  63. drawtype = "glasslike",
  64. description = S("Wood Framed Glass"),
  65. stair_desc = S("Wood Framed Glass Stair"),
  66. slab_desc = S("Wood Framed Glass Slab"),
  67. tiles = {"building_blocks_wglass.png"},
  68. paramtype = "light",
  69. sunlight_propagates = true,
  70. is_ground_content = true,
  71. groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3},
  72. sounds = default.node_sound_glass_defaults(),
  73. })
  74. building_blocks_stairs("building_blocks:Adobe", {
  75. tiles = {"building_blocks_Adobe.png"},
  76. description = S("Adobe"),
  77. stair_desc = S("Adobe Stair"),
  78. slab_desc = S("Adobe Slab"),
  79. is_ground_content = true,
  80. groups = {crumbly=3},
  81. sounds = default.node_sound_stone_defaults(),
  82. })
  83. building_blocks_stairs("building_blocks:fakegrass", {
  84. tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
  85. description = S("Fake Grass"),
  86. stair_desc = S("Fake Grass Stair"),
  87. slab_desc = S("Fake Grass Slab"),
  88. is_ground_content = true,
  89. groups = {crumbly=3},
  90. sounds = default.node_sound_dirt_defaults({
  91. footstep = {name="default_grass_footstep", gain=0.4},
  92. }),
  93. })
  94. building_blocks_stairs("building_blocks:hardwood", {
  95. tiles = {"building_blocks_hardwood.png"},
  96. is_ground_content = true,
  97. description = S("Hardwood"),
  98. stair_desc = S("Hardwood Stair"),
  99. slab_desc = S("Hardwood Slab"),
  100. groups = {choppy=1,flammable=1},
  101. sounds = default.node_sound_wood_defaults(),
  102. })
  103. building_blocks_stairs("building_blocks:Roofing", {
  104. tiles = {"building_blocks_Roofing.png"},
  105. is_ground_content = true,
  106. description = S("Roof block"),
  107. stair_desc = S("Roof block Stair"),
  108. slab_desc = S("Roof block Slab"),
  109. groups = {snappy=3},
  110. sounds = default.node_sound_stone_defaults(),
  111. })
  112. building_blocks_stairs("building_blocks:Tar", {
  113. description = S("Tar"),
  114. stair_desc = S("Tar Stair"),
  115. slab_desc = S("Tar Slab"),
  116. tiles = {"building_blocks_tar.png"},
  117. is_ground_content = true,
  118. groups = {crumbly=1, tar_block = 1},
  119. sounds = default.node_sound_stone_defaults(),
  120. })
  121. building_blocks_stairs("building_blocks:Marble", {
  122. description = S("Marble"),
  123. stair_desc = S("Marble Stair"),
  124. slab_desc = S("Marble Slab"),
  125. tiles = {"building_blocks_marble.png"},
  126. is_ground_content = true,
  127. groups = {cracky=3, marble = 1},
  128. sounds = default.node_sound_stone_defaults(),
  129. })
  130. minetest.register_node("building_blocks:brobble_spread", {
  131. drawtype = "raillike",
  132. -- Translators: "Brobble" is a portmanteau of "Brick" and "Cobble".
  133. -- Translate however you see fit.
  134. description = S("Brobble Spread"),
  135. tiles = {"building_blocks_brobble.png"},
  136. inventory_image = "building_blocks_brobble_spread_inv.png",
  137. paramtype = "light",
  138. walkable = false,
  139. selection_box = {
  140. type = "fixed",
  141. -- but how to specify the dimensions for curved and sideways rails?
  142. fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
  143. },
  144. sunlight_propagates = true,
  145. is_ground_content = true,
  146. groups = {crumbly=3},
  147. })
  148. if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopblocks") then
  149. minetest.register_node("building_blocks:gravel_spread", {
  150. drawtype = "raillike",
  151. description = S("Gravel Spread"),
  152. tiles = {"default_gravel.png"},
  153. inventory_image = "building_blocks_gravel_spread_inv.png",
  154. paramtype = "light",
  155. walkable = false,
  156. selection_box = {
  157. type = "fixed",
  158. -- but how to specify the dimensions for curved and sideways rails?
  159. fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
  160. },
  161. sunlight_propagates = true,
  162. is_ground_content = true,
  163. groups = {crumbly=2},
  164. sounds = default.node_sound_dirt_defaults({
  165. footstep = {name="default_gravel_footstep", gain=0.5},
  166. dug = {name="default_gravel_footstep", gain=1.0},
  167. }),
  168. })
  169. end
  170. minetest.register_node("building_blocks:Tarmac_spread", {
  171. drawtype = "raillike",
  172. description = S("Tarmac Spread"),
  173. tiles = {"building_blocks_tar.png"},
  174. inventory_image = "building_blocks_tar_spread_inv.png",
  175. paramtype = "light",
  176. walkable = false,
  177. selection_box = {
  178. type = "fixed",
  179. -- but how to specify the dimensions for curved and sideways rails?
  180. fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
  181. },
  182. sunlight_propagates = true,
  183. is_ground_content = true,
  184. groups = {cracky=3},
  185. sounds = default.node_sound_dirt_defaults(),
  186. })
  187. minetest.register_node("building_blocks:terrycloth_towel", {
  188. drawtype = "raillike",
  189. description = S("Terrycloth towel"),
  190. tiles = {"building_blocks_towel.png"},
  191. inventory_image = "building_blocks_towel_inv.png",
  192. paramtype = "light",
  193. walkable = false,
  194. selection_box = {
  195. type = "fixed",
  196. -- but how to specify the dimensions for curved and sideways rails?
  197. fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
  198. },
  199. sunlight_propagates = true,
  200. is_ground_content = true,
  201. groups = {crumbly=3},
  202. })
  203. minetest.register_node("building_blocks:BWtile", {
  204. drawtype = "nodebox",
  205. description = S("Chess board tiling"),
  206. tiles = {
  207. "building_blocks_BWtile.png",
  208. "building_blocks_BWtile.png^[transformR90",
  209. "building_blocks_BWtile.png^[transformR90",
  210. "building_blocks_BWtile.png^[transformR90",
  211. "building_blocks_BWtile.png",
  212. "building_blocks_BWtile.png"
  213. },
  214. inventory_image = "building_blocks_bwtile_inv.png",
  215. paramtype = "light",
  216. walkable = false,
  217. node_box = {
  218. type = "fixed",
  219. fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
  220. },
  221. sunlight_propagates = true,
  222. is_ground_content = true,
  223. groups = {crumbly=3},
  224. })
  225. minetest.register_node("building_blocks:Fireplace", {
  226. description = S("Fireplace"),
  227. tiles = {
  228. "building_blocks_cast_iron.png",
  229. "building_blocks_cast_iron.png",
  230. "building_blocks_cast_iron.png",
  231. "building_blocks_cast_iron_fireplace.png"
  232. },
  233. paramtype = "light",
  234. paramtype2 = "facedir",
  235. light_source = default.LIGHT_MAX,
  236. sunlight_propagates = true,
  237. is_ground_content = true,
  238. groups = {cracky=2},
  239. sounds = default.node_sound_stone_defaults(),
  240. })