You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

498 lines
16KB

  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. paramtype = "light",
  185. sunlight_propagates = true,
  186. is_ground_content = false,
  187. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  188. sounds = sound_glass,
  189. },
  190. ["coal_glass"] = {
  191. description = S("Coal Glass"),
  192. drawtype = "glasslike_framed_optional",
  193. tiles = {"default_glass.png^[colorize:#828282", "default_glass_detail.png^[colorize:#828282"},
  194. paramtype = "light",
  195. sunlight_propagates = true,
  196. is_ground_content = false,
  197. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  198. sounds = sound_glass,
  199. },
  200. ["clean_glass"] = {
  201. description = S("Clean Glass"),
  202. drawtype = "glasslike_framed_optional",
  203. tiles = {"moreblocks_clean_glass.png", "moreblocks_clean_glass_detail.png"},
  204. paramtype = "light",
  205. sunlight_propagates = true,
  206. is_ground_content = false,
  207. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  208. sounds = sound_glass,
  209. },
  210. ["cactus_brick"] = {
  211. description = S("Cactus Brick"),
  212. paramtype2 = "facedir",
  213. place_param2 = 0,
  214. groups = {cracky = 3},
  215. is_ground_content = false,
  216. sounds = sound_stone,
  217. },
  218. ["cactus_checker"] = {
  219. description = S("Cactus Checker"),
  220. groups = {stone = 1, cracky = 3},
  221. is_ground_content = false,
  222. tiles = {"default_stone.png^moreblocks_cactus_checker.png",
  223. "default_stone.png^moreblocks_cactus_checker.png",
  224. "default_stone.png^moreblocks_cactus_checker.png",
  225. "default_stone.png^moreblocks_cactus_checker.png",
  226. "default_stone.png^moreblocks_cactus_checker.png^[transformR90",
  227. "default_stone.png^moreblocks_cactus_checker.png^[transformR90"},
  228. sounds = sound_stone,
  229. },
  230. ["empty_shelf"] = {
  231. description = S("Empty Shelf"),
  232. paramtype2 = "facedir",
  233. tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
  234. "default_wood.png", "moreblocks_empty_shelf.png", "moreblocks_empty_shelf.png"},
  235. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  236. is_ground_content = false,
  237. sounds = sound_wood,
  238. furnace_burntime = 15,
  239. no_stairs = true,
  240. },
  241. ["coal_stone"] = {
  242. description = S("Coal Stone"),
  243. groups = {stone = 1, cracky = 3},
  244. is_ground_content = false,
  245. sounds = sound_stone,
  246. },
  247. ["iron_stone"] = {
  248. description = S("Iron Stone"),
  249. groups = {stone = 1, cracky = 3},
  250. is_ground_content = false,
  251. sounds = sound_stone,
  252. },
  253. ["coal_checker"] = {
  254. description = S("Coal Checker"),
  255. tiles = {"default_stone.png^moreblocks_coal_checker.png",
  256. "default_stone.png^moreblocks_coal_checker.png",
  257. "default_stone.png^moreblocks_coal_checker.png",
  258. "default_stone.png^moreblocks_coal_checker.png",
  259. "default_stone.png^moreblocks_coal_checker.png^[transformR90",
  260. "default_stone.png^moreblocks_coal_checker.png^[transformR90"},
  261. groups = {stone = 1, cracky = 3},
  262. is_ground_content = false,
  263. sounds = sound_stone,
  264. },
  265. ["iron_checker"] = {
  266. description = S("Iron Checker"),
  267. tiles = {"default_stone.png^moreblocks_iron_checker.png",
  268. "default_stone.png^moreblocks_iron_checker.png",
  269. "default_stone.png^moreblocks_iron_checker.png",
  270. "default_stone.png^moreblocks_iron_checker.png",
  271. "default_stone.png^moreblocks_iron_checker.png^[transformR90",
  272. "default_stone.png^moreblocks_iron_checker.png^[transformR90"},
  273. groups = {stone = 1, cracky = 3},
  274. is_ground_content = false,
  275. sounds = sound_stone,
  276. },
  277. ["trap_stone"] = {
  278. description = S("Trap Stone"),
  279. drawtype = "glasslike_framed",
  280. tiles = {"default_stone.png^moreblocks_trap_box.png"},
  281. walkable = false,
  282. groups = {cracky = 3},
  283. paramtype = "light",
  284. is_ground_content = false,
  285. sounds = sound_stone,
  286. no_stairs = true,
  287. },
  288. ["trap_desert_stone"] = {
  289. description = S("Trap Desert Stone"),
  290. drawtype = "glasslike_framed",
  291. tiles = {"default_desert_stone.png^moreblocks_trap_box.png"},
  292. walkable = false,
  293. groups = {cracky = 3},
  294. paramtype = "light",
  295. is_ground_content = false,
  296. sounds = sound_stone,
  297. no_stairs = true,
  298. },
  299. ["trap_glass"] = {
  300. description = S("Trap Glass"),
  301. drawtype = "glasslike_framed_optional",
  302. tiles = {"default_glass.png^moreblocks_trap_box_glass.png", "default_glass_detail.png"},
  303. paramtype = "light",
  304. sunlight_propagates = true,
  305. is_ground_content = false,
  306. walkable = false,
  307. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  308. sounds = sound_glass,
  309. no_stairs = true,
  310. },
  311. ["trap_obsidian_glass"] = {
  312. description = S("Trap Obsidian Glass"),
  313. drawtype = "glasslike_framed_optional",
  314. tiles = {"default_obsidian_glass.png^moreblocks_trap_box_glass.png", "default_obsidian_glass_detail.png"},
  315. paramtype = "light",
  316. sunlight_propagates = true,
  317. is_ground_content = false,
  318. walkable = false,
  319. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  320. sounds = sound_glass,
  321. no_stairs = true,
  322. },
  323. ["trap_obsidian"] = {
  324. description = S("Trap Obsidian"),
  325. drawtype = "glasslike_framed",
  326. tiles = {"default_obsidian.png^moreblocks_trap_box.png"},
  327. walkable = false,
  328. groups = {cracky = 1, level = 2},
  329. paramtype = "light",
  330. is_ground_content = false,
  331. sounds = sound_stone,
  332. no_stairs = true,
  333. },
  334. ["trap_sandstone"] = {
  335. description = S("Trap Sandstone"),
  336. drawtype = "glasslike_framed",
  337. tiles = {"default_sandstone.png^moreblocks_trap_box.png"},
  338. walkable = false,
  339. groups = {crumbly = 1, cracky = 3},
  340. paramtype = "light",
  341. is_ground_content = false,
  342. sounds = sound_stone,
  343. no_stairs = true,
  344. },
  345. ["all_faces_tree"] = {
  346. description = S("All-faces Tree"),
  347. tiles = {"default_tree_top.png"},
  348. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  349. sounds = sound_wood,
  350. furnace_burntime = 30,
  351. },
  352. ["all_faces_jungle_tree"] = {
  353. description = S("All-faces Jungle Tree"),
  354. tiles = {"default_jungletree_top.png"},
  355. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  356. sounds = sound_wood,
  357. furnace_burntime = 38,
  358. },
  359. ["all_faces_pine_tree"] = {
  360. description = S("All-faces Pine Tree"),
  361. tiles = {"default_pine_tree_top.png"},
  362. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  363. sounds = sound_wood,
  364. furnace_burntime = 26,
  365. },
  366. ["all_faces_acacia_tree"] = {
  367. description = S("All-faces Acacia Tree"),
  368. tiles = {"default_acacia_tree_top.png"},
  369. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  370. sounds = sound_wood,
  371. furnace_burntime = 34,
  372. },
  373. ["all_faces_aspen_tree"] = {
  374. description = S("All-faces Aspen Tree"),
  375. tiles = {"default_aspen_tree_top.png"},
  376. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  377. sounds = sound_wood,
  378. furnace_burntime = 22,
  379. },
  380. ["glow_glass"] = {
  381. description = S("Glow Glass"),
  382. drawtype = "glasslike_framed_optional",
  383. tiles = {"default_glass.png^[colorize:#E9CD61", "default_glass_detail.png^[colorize:#E9CD61"},
  384. paramtype = "light",
  385. sunlight_propagates = true,
  386. is_ground_content = false,
  387. light_source = 11,
  388. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  389. sounds = sound_glass,
  390. },
  391. ["trap_glow_glass"] = {
  392. description = S("Trap Glow Glass"),
  393. drawtype = "glasslike_framed_optional",
  394. tiles = {"default_glass.png^[colorize:#E9CD61^moreblocks_trap_box_glass.png", "default_glass_detail.png^[colorize:#E9CD61"},
  395. paramtype = "light",
  396. sunlight_propagates = true,
  397. is_ground_content = false,
  398. light_source = 11,
  399. walkable = false,
  400. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  401. sounds = sound_glass,
  402. no_stairs = true,
  403. },
  404. ["super_glow_glass"] = {
  405. description = S("Super Glow Glass"),
  406. drawtype = "glasslike_framed_optional",
  407. tiles = {"default_glass.png^[colorize:#FFFF78", "default_glass_detail.png^[colorize:#FFFF78"},
  408. paramtype = "light",
  409. sunlight_propagates = true,
  410. is_ground_content = false,
  411. light_source = default.LIGHT_MAX,
  412. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  413. sounds = sound_glass,
  414. },
  415. ["trap_super_glow_glass"] = {
  416. description = S("Trap Super Glow Glass"),
  417. drawtype = "glasslike_framed_optional",
  418. tiles = {"default_glass.png^[colorize:#FFFF78^moreblocks_trap_box_glass.png", "default_glass_detail.png^[colorize:#FFFF78"},
  419. paramtype = "light",
  420. sunlight_propagates = true,
  421. is_ground_content = false,
  422. light_source = default.LIGHT_MAX,
  423. walkable = false,
  424. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  425. sounds = sound_glass,
  426. no_stairs = true,
  427. },
  428. ["rope"] = {
  429. description = S("Rope"),
  430. drawtype = "signlike",
  431. inventory_image = "moreblocks_rope.png",
  432. wield_image = "moreblocks_rope.png",
  433. paramtype = "light",
  434. sunlight_propagates = true,
  435. is_ground_content = false,
  436. paramtype2 = "wallmounted",
  437. walkable = false,
  438. climbable = true,
  439. selection_box = {type = "wallmounted",},
  440. groups = {snappy = 3, flammable = 2},
  441. sounds = sound_leaves,
  442. no_stairs = true,
  443. },
  444. ["copperpatina"] = {
  445. description = S("Copper Patina Block"),
  446. groups = {cracky = 1, level = 2},
  447. is_ground_content = false,
  448. sounds = sound_metal,
  449. },
  450. }
  451. for name, def in pairs(nodes) do
  452. def.tiles = def.tiles or {"moreblocks_" ..name.. ".png"}
  453. minetest.register_node("moreblocks:" ..name, def)
  454. minetest.register_alias(name, "moreblocks:" ..name)
  455. def_copy = table.copy(def)
  456. -- Use the primary tile for all sides of cut glasslike nodes.
  457. -- This makes them easier to see
  458. if
  459. #def_copy.tiles > 1 and
  460. def_copy.drawtype and
  461. def_copy.drawtype == "glasslike_framed" or
  462. def_copy.drawtype == "glasslike_framed_optional"
  463. then
  464. def.tiles = {def_copy.tiles[1]}
  465. end
  466. if not def.no_stairs then
  467. local groups = {}
  468. for k, v in pairs(def.groups) do groups[k] = v end
  469. stairsplus:register_all("moreblocks", name, "moreblocks:" ..name, {
  470. description = def.description,
  471. groups = groups,
  472. tiles = def.tiles,
  473. sunlight_propagates = def.sunlight_propagates,
  474. light_source = def.light_source,
  475. sounds = def.sounds,
  476. })
  477. end
  478. end
  479. -- Items
  480. minetest.register_craftitem("moreblocks:sweeper", {
  481. description = S("Sweeper"),
  482. inventory_image = "moreblocks_sweeper.png",
  483. })