nodes.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. --[[
  2. More Blocks: node definitions
  3. Copyright © 2011-2020 Hugo Locurcio and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. local S = moreblocks.S
  7. local sound_dirt = default.node_sound_dirt_defaults()
  8. local sound_wood = default.node_sound_wood_defaults()
  9. local sound_stone = default.node_sound_stone_defaults()
  10. local sound_glass = default.node_sound_glass_defaults()
  11. local sound_leaves = default.node_sound_leaves_defaults()
  12. -- Don't break on 0.4.14 and earlier.
  13. local sound_metal = (default.node_sound_metal_defaults
  14. and default.node_sound_metal_defaults() or sound_stone)
  15. local function tile_tiles(name)
  16. local tex = "moreblocks_" ..name.. ".png"
  17. return {tex, tex, tex, tex, tex.. "^[transformR90", tex.. "^[transformR90"}
  18. end
  19. local function wood_tile_replace(itemstack, placer, pointed_thing)
  20. local substack
  21. if itemstack:get_name() == "moreblocks:wood_tile_flipped" then
  22. substack = ItemStack("moreblocks:wood_tile")
  23. else -- right, left, and down variants
  24. substack = ItemStack("moreblocks:wood_tile_offset")
  25. end
  26. local _, success = minetest.item_place(substack, placer, pointed_thing)
  27. if success then
  28. itemstack:take_item()
  29. end
  30. return itemstack
  31. end
  32. local deprecated = (" (%s)"):format(S('Deprecated'))
  33. local nodes = {
  34. ["wood_tile"] = {
  35. description = S("Wooden Tile"),
  36. groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
  37. is_ground_content = false,
  38. paramtype2 = "facedir",
  39. place_param2 = 0,
  40. tiles = {"default_wood.png^moreblocks_wood_tile.png",
  41. "default_wood.png^moreblocks_wood_tile.png",
  42. "default_wood.png^moreblocks_wood_tile.png",
  43. "default_wood.png^moreblocks_wood_tile.png",
  44. "default_wood.png^moreblocks_wood_tile.png^[transformR90",
  45. "default_wood.png^moreblocks_wood_tile.png^[transformR90"},
  46. sounds = sound_wood,
  47. },
  48. ["wood_tile_flipped"] = {
  49. description = S("Wooden Tile") .. deprecated,
  50. tiles = {"default_wood.png^moreblocks_wood_tile.png^[transformR90",
  51. "default_wood.png^moreblocks_wood_tile.png^[transformR90",
  52. "default_wood.png^moreblocks_wood_tile.png^[transformR90",
  53. "default_wood.png^moreblocks_wood_tile.png^[transformR90",
  54. "default_wood.png^moreblocks_wood_tile.png^[transformR180",
  55. "default_wood.png^moreblocks_wood_tile.png^[transformR180"},
  56. no_stairs = true,
  57. on_place = wood_tile_replace
  58. },
  59. ["wood_tile_center"] = {
  60. description = S("Centered Wooden Tile"),
  61. groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
  62. is_ground_content = false,
  63. tiles = {"default_wood.png^moreblocks_wood_tile_center.png"},
  64. sounds = sound_wood,
  65. },
  66. ["wood_tile_full"] = {
  67. description = S("Full Wooden Tile"),
  68. groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
  69. is_ground_content = false,
  70. tiles = tile_tiles("wood_tile_full"),
  71. sounds = sound_wood,
  72. },
  73. ["wood_tile_offset"] = {
  74. description = S("Offset Wooden Tile"),
  75. paramtype2 = "facedir",
  76. place_param2 = 0,
  77. groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
  78. is_ground_content = false,
  79. tiles = {"default_wood.png^moreblocks_wood_tile_offset.png"},
  80. sounds = sound_wood,
  81. no_stairs = true,
  82. },
  83. ["wood_tile_down"] = {
  84. description = S("Downwards Wooden Tile") .. deprecated,
  85. tiles = {"default_wood.png^[transformR180^moreblocks_wood_tile_offset.png^[transformR180"},
  86. no_stairs = true,
  87. on_place = wood_tile_replace
  88. },
  89. ["wood_tile_left"] = {
  90. description = S("Leftwards Wooden Tile") .. deprecated,
  91. tiles = {"default_wood.png^[transformR270^moreblocks_wood_tile_offset.png^[transformR270"},
  92. no_stairs = true,
  93. on_place = wood_tile_replace
  94. },
  95. ["wood_tile_right"] = {
  96. description = S("Rightwards Wooden Tile") .. deprecated,
  97. tiles = {"default_wood.png^[transformR90^moreblocks_wood_tile_offset.png^[transformR90"},
  98. no_stairs = true,
  99. on_place = wood_tile_replace
  100. },
  101. ["circle_stone_bricks"] = {
  102. description = S("Circle Stone Bricks"),
  103. groups = {stone = 1, cracky = 3},
  104. is_ground_content = false,
  105. sounds = sound_stone,
  106. },
  107. ["grey_bricks"] = {
  108. description = S("Stone Bricks"),
  109. paramtype2 = "facedir",
  110. place_param2 = 0,
  111. groups = {cracky = 3},
  112. is_ground_content = false,
  113. sounds = sound_stone,
  114. },
  115. ["coal_stone_bricks"] = {
  116. description = S("Coal Stone Bricks"),
  117. paramtype2 = "facedir",
  118. place_param2 = 0,
  119. groups = {stone = 1, cracky = 3},
  120. is_ground_content = false,
  121. sounds = sound_stone,
  122. },
  123. ["iron_stone_bricks"] = {
  124. description = S("Iron Stone Bricks"),
  125. paramtype2 = "facedir",
  126. place_param2 = 0,
  127. groups = {stone = 1, cracky = 3},
  128. is_ground_content = false,
  129. sounds = sound_stone,
  130. },
  131. ["stone_tile"] = {
  132. description = S("Stone Tile"),
  133. groups = {stone = 1, cracky = 3},
  134. is_ground_content = false,
  135. sounds = sound_stone,
  136. },
  137. ["split_stone_tile"] = {
  138. description = S("Split Stone Tile"),
  139. paramtype2 = "facedir",
  140. place_param2 = 0,
  141. tiles = {"moreblocks_split_stone_tile_top.png",
  142. "moreblocks_split_stone_tile.png"},
  143. groups = {stone = 1, cracky = 3},
  144. is_ground_content = false,
  145. sounds = sound_stone,
  146. },
  147. ["checker_stone_tile"] = {
  148. description = S("Checker Stone Tile"),
  149. groups = {stone = 1, cracky = 3},
  150. is_ground_content = false,
  151. sounds = sound_stone,
  152. },
  153. ["tar"] = {
  154. description = S("Tar"),
  155. groups = {cracky=2, tar_block=1},
  156. is_ground_content = false,
  157. sounds = sound_stone,
  158. },
  159. ["dirt_compressed"] = {
  160. description = S("Compressed Dirt"),
  161. groups = {crumbly=2},
  162. is_ground_content = false,
  163. sounds = sound_dirt,
  164. },
  165. ["cobble_compressed"] = {
  166. description = S("Compressed Cobblestone"),
  167. groups = {cracky = 1},
  168. is_ground_content = false,
  169. sounds = sound_stone,
  170. },
  171. ["plankstone"] = {
  172. description = S("Plankstone"),
  173. paramtype2 = "facedir",
  174. place_param2 = 0,
  175. groups = {cracky = 3},
  176. is_ground_content = false,
  177. tiles = tile_tiles("plankstone"),
  178. sounds = sound_stone,
  179. },
  180. ["iron_glass"] = {
  181. description = S("Iron Glass"),
  182. drawtype = "glasslike_framed_optional",
  183. tiles = {"default_glass.png^[colorize:#DEDEDE", "default_glass_detail.png^[colorize:#DEDEDE"},
  184. use_texture_alpha = 'clip',
  185. paramtype = "light",
  186. sunlight_propagates = true,
  187. is_ground_content = false,
  188. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  189. sounds = sound_glass,
  190. },
  191. ["coal_glass"] = {
  192. description = S("Coal Glass"),
  193. drawtype = "glasslike_framed_optional",
  194. tiles = {"default_glass.png^[colorize:#828282", "default_glass_detail.png^[colorize:#828282"},
  195. use_texture_alpha = 'clip',
  196. paramtype = "light",
  197. sunlight_propagates = true,
  198. is_ground_content = false,
  199. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  200. sounds = sound_glass,
  201. },
  202. ["clean_glass"] = {
  203. description = S("Clean Glass"),
  204. drawtype = "glasslike_framed_optional",
  205. tiles = {"moreblocks_clean_glass.png", "moreblocks_clean_glass_detail.png"},
  206. use_texture_alpha = 'clip',
  207. paramtype = "light",
  208. sunlight_propagates = true,
  209. is_ground_content = false,
  210. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  211. sounds = sound_glass,
  212. },
  213. ["cactus_brick"] = {
  214. description = S("Cactus Brick"),
  215. paramtype2 = "facedir",
  216. place_param2 = 0,
  217. groups = {cracky = 3},
  218. is_ground_content = false,
  219. sounds = sound_stone,
  220. },
  221. ["cactus_checker"] = {
  222. description = S("Cactus Checker"),
  223. groups = {stone = 1, cracky = 3},
  224. is_ground_content = false,
  225. tiles = {"default_stone.png^moreblocks_cactus_checker.png",
  226. "default_stone.png^moreblocks_cactus_checker.png",
  227. "default_stone.png^moreblocks_cactus_checker.png",
  228. "default_stone.png^moreblocks_cactus_checker.png",
  229. "default_stone.png^moreblocks_cactus_checker.png^[transformR90",
  230. "default_stone.png^moreblocks_cactus_checker.png^[transformR90"},
  231. sounds = sound_stone,
  232. },
  233. ["empty_shelf"] = {
  234. description = S("Empty Shelf"),
  235. paramtype2 = "facedir",
  236. tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
  237. "default_wood.png", "moreblocks_empty_shelf.png", "moreblocks_empty_shelf.png"},
  238. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  239. is_ground_content = false,
  240. sounds = sound_wood,
  241. furnace_burntime = 15,
  242. no_stairs = true,
  243. },
  244. ["coal_stone"] = {
  245. description = S("Coal Stone"),
  246. groups = {stone = 1, cracky = 3},
  247. is_ground_content = false,
  248. sounds = sound_stone,
  249. },
  250. ["iron_stone"] = {
  251. description = S("Iron Stone"),
  252. groups = {stone = 1, cracky = 3},
  253. is_ground_content = false,
  254. sounds = sound_stone,
  255. },
  256. ["coal_checker"] = {
  257. description = S("Coal Checker"),
  258. tiles = {"default_stone.png^moreblocks_coal_checker.png",
  259. "default_stone.png^moreblocks_coal_checker.png",
  260. "default_stone.png^moreblocks_coal_checker.png",
  261. "default_stone.png^moreblocks_coal_checker.png",
  262. "default_stone.png^moreblocks_coal_checker.png^[transformR90",
  263. "default_stone.png^moreblocks_coal_checker.png^[transformR90"},
  264. groups = {stone = 1, cracky = 3},
  265. is_ground_content = false,
  266. sounds = sound_stone,
  267. },
  268. ["iron_checker"] = {
  269. description = S("Iron Checker"),
  270. tiles = {"default_stone.png^moreblocks_iron_checker.png",
  271. "default_stone.png^moreblocks_iron_checker.png",
  272. "default_stone.png^moreblocks_iron_checker.png",
  273. "default_stone.png^moreblocks_iron_checker.png",
  274. "default_stone.png^moreblocks_iron_checker.png^[transformR90",
  275. "default_stone.png^moreblocks_iron_checker.png^[transformR90"},
  276. groups = {stone = 1, cracky = 3},
  277. is_ground_content = false,
  278. sounds = sound_stone,
  279. },
  280. ["trap_stone"] = {
  281. description = S("Trap Stone"),
  282. drawtype = "glasslike_framed",
  283. tiles = {"default_stone.png"},
  284. walkable = false,
  285. groups = {cracky = 3},
  286. paramtype = "light",
  287. is_ground_content = false,
  288. sounds = sound_stone,
  289. no_stairs = true,
  290. },
  291. ["trap_desert_stone"] = {
  292. description = S("Trap Desert Stone"),
  293. drawtype = "glasslike_framed",
  294. tiles = {"default_desert_stone.png"},
  295. walkable = false,
  296. groups = {cracky = 3},
  297. paramtype = "light",
  298. is_ground_content = false,
  299. sounds = sound_stone,
  300. no_stairs = true,
  301. },
  302. ["trap_glass"] = {
  303. description = S("Trap Glass"),
  304. drawtype = "glasslike_framed_optional",
  305. tiles = {"default_glass.png", "default_glass_detail.png"},
  306. paramtype = "light",
  307. sunlight_propagates = true,
  308. is_ground_content = false,
  309. walkable = false,
  310. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  311. sounds = sound_glass,
  312. no_stairs = true,
  313. },
  314. ["trap_obsidian_glass"] = {
  315. description = S("Trap Obsidian Glass"),
  316. drawtype = "glasslike_framed_optional",
  317. tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
  318. paramtype = "light",
  319. sunlight_propagates = true,
  320. is_ground_content = false,
  321. walkable = false,
  322. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  323. sounds = sound_glass,
  324. no_stairs = true,
  325. },
  326. ["trap_obsidian"] = {
  327. description = S("Trap Obsidian"),
  328. drawtype = "glasslike_framed",
  329. tiles = {"default_obsidian.png"},
  330. walkable = false,
  331. groups = {cracky = 1, level = 2},
  332. paramtype = "light",
  333. is_ground_content = false,
  334. sounds = sound_stone,
  335. no_stairs = true,
  336. },
  337. ["trap_sandstone"] = {
  338. description = S("Trap Sandstone"),
  339. drawtype = "glasslike_framed",
  340. tiles = {"default_sandstone.png"},
  341. walkable = false,
  342. groups = {crumbly = 1, cracky = 3},
  343. paramtype = "light",
  344. is_ground_content = false,
  345. sounds = sound_stone,
  346. no_stairs = true,
  347. },
  348. ["all_faces_tree"] = {
  349. description = S("All-faces Tree"),
  350. tiles = {"default_tree_top.png"},
  351. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  352. sounds = sound_wood,
  353. furnace_burntime = 30,
  354. },
  355. ["all_faces_jungle_tree"] = {
  356. description = S("All-faces Jungle Tree"),
  357. tiles = {"default_jungletree_top.png"},
  358. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  359. sounds = sound_wood,
  360. furnace_burntime = 38,
  361. },
  362. ["all_faces_pine_tree"] = {
  363. description = S("All-faces Pine Tree"),
  364. tiles = {"default_pine_tree_top.png"},
  365. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  366. sounds = sound_wood,
  367. furnace_burntime = 26,
  368. },
  369. ["all_faces_acacia_tree"] = {
  370. description = S("All-faces Acacia Tree"),
  371. tiles = {"default_acacia_tree_top.png"},
  372. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  373. sounds = sound_wood,
  374. furnace_burntime = 34,
  375. },
  376. ["all_faces_aspen_tree"] = {
  377. description = S("All-faces Aspen Tree"),
  378. tiles = {"default_aspen_tree_top.png"},
  379. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  380. sounds = sound_wood,
  381. furnace_burntime = 22,
  382. },
  383. ["glow_glass"] = {
  384. description = S("Glow Glass"),
  385. drawtype = "glasslike_framed_optional",
  386. tiles = {"default_glass.png^[colorize:#E9CD61", "default_glass_detail.png^[colorize:#E9CD61"},
  387. use_texture_alpha = 'clip',
  388. paramtype = "light",
  389. sunlight_propagates = true,
  390. is_ground_content = false,
  391. light_source = 11,
  392. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  393. sounds = sound_glass,
  394. },
  395. ["trap_glow_glass"] = {
  396. description = S("Trap Glow Glass"),
  397. drawtype = "glasslike_framed_optional",
  398. tiles = {"default_glass.png^[colorize:#E9CD61", "default_glass_detail.png^[colorize:#E9CD61"},
  399. use_texture_alpha = 'clip',
  400. paramtype = "light",
  401. sunlight_propagates = true,
  402. is_ground_content = false,
  403. light_source = 11,
  404. walkable = false,
  405. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  406. sounds = sound_glass,
  407. no_stairs = true,
  408. },
  409. ["super_glow_glass"] = {
  410. description = S("Super Glow Glass"),
  411. drawtype = "glasslike_framed_optional",
  412. tiles = {"default_glass.png^[colorize:#FFFF78", "default_glass_detail.png^[colorize:#FFFF78"},
  413. use_texture_alpha = 'clip',
  414. paramtype = "light",
  415. sunlight_propagates = true,
  416. is_ground_content = false,
  417. light_source = default.LIGHT_MAX,
  418. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  419. sounds = sound_glass,
  420. },
  421. ["trap_super_glow_glass"] = {
  422. description = S("Trap Super Glow Glass"),
  423. drawtype = "glasslike_framed_optional",
  424. tiles = {"default_glass.png^[colorize:#FFFF78", "default_glass_detail.png^[colorize:#FFFF78"},
  425. use_texture_alpha = 'clip',
  426. paramtype = "light",
  427. sunlight_propagates = true,
  428. is_ground_content = false,
  429. light_source = default.LIGHT_MAX,
  430. walkable = false,
  431. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  432. sounds = sound_glass,
  433. no_stairs = true,
  434. },
  435. ["rope"] = {
  436. description = S("Rope"),
  437. drawtype = "signlike",
  438. inventory_image = "moreblocks_rope.png",
  439. wield_image = "moreblocks_rope.png",
  440. paramtype = "light",
  441. sunlight_propagates = true,
  442. is_ground_content = false,
  443. paramtype2 = "wallmounted",
  444. walkable = false,
  445. climbable = true,
  446. selection_box = {type = "wallmounted",},
  447. groups = {snappy = 3, flammable = 2},
  448. sounds = sound_leaves,
  449. no_stairs = true,
  450. },
  451. ["copperpatina"] = {
  452. description = S("Copper Patina Block"),
  453. groups = {cracky = 1, level = 2},
  454. is_ground_content = false,
  455. sounds = sound_metal,
  456. },
  457. }
  458. for name, def in pairs(nodes) do
  459. def.tiles = def.tiles or {"moreblocks_" ..name.. ".png"}
  460. minetest.register_node("moreblocks:" ..name, def)
  461. minetest.register_alias(name, "moreblocks:" ..name)
  462. def_copy = table.copy(def)
  463. -- Use the primary tile for all sides of cut glasslike nodes.
  464. -- This makes them easier to see
  465. if
  466. #def_copy.tiles > 1 and
  467. def_copy.drawtype and
  468. def_copy.drawtype == "glasslike_framed" or
  469. def_copy.drawtype == "glasslike_framed_optional"
  470. then
  471. def.tiles = {def_copy.tiles[1]}
  472. def.use_texture_alpha = 'clip'
  473. end
  474. if not def.no_stairs then
  475. local groups = {}
  476. for k, v in pairs(def.groups) do groups[k] = v end
  477. stairsplus:register_all("moreblocks", name, "moreblocks:" ..name, {
  478. description = def.description,
  479. groups = groups,
  480. tiles = def.tiles,
  481. sunlight_propagates = def.sunlight_propagates,
  482. light_source = (def.light_source-2),
  483. sounds = def.sounds,
  484. })
  485. end
  486. end
  487. -- Items
  488. minetest.register_craftitem("moreblocks:sweeper", {
  489. description = S("Sweeper"),
  490. inventory_image = "moreblocks_sweeper.png",
  491. })