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.

482 lines
15KB

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