More Blocks
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.
 
 
 

504 lines
16 KiB

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