nodes.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. local S = maple.get_translator;
  2. minetest.register_node("maple:maple_tree", {
  3. description = S("Maple Tree"),
  4. tiles = {"maple_tree_top.png", "maple_tree_top.png", "maple_tree.png"},
  5. paramtype2 = "facedir",
  6. is_ground_content = false,
  7. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  8. sounds = default.node_sound_wood_defaults(),
  9. on_place = minetest.rotate_node
  10. })
  11. minetest.register_node("maple:maple_wood", {
  12. description = S("Maple Wood Planks"),
  13. paramtype2 = "facedir",
  14. place_param2 = 0,
  15. tiles = {"maple_wood.png"},
  16. is_ground_content = false,
  17. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
  18. sounds = default.node_sound_wood_defaults(),
  19. })
  20. minetest.register_node("maple:maple_leaves", {
  21. description = S("Maple Leaves"),
  22. drawtype = "allfaces_optional",
  23. waving = 1,
  24. tiles = {"maple_leaves.png"},
  25. special_tiles = {"maple_leaves_simple.png"},
  26. paramtype = "light",
  27. is_ground_content = false,
  28. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  29. drop = {
  30. max_items = 1,
  31. items = {
  32. {
  33. -- player will get sapling with 1/50 chance
  34. items = {'maple:maple_sapling'},
  35. rarity = 50,
  36. },
  37. {
  38. -- player will get leaves only if he get no saplings,
  39. -- this is because max_items is 1
  40. items = {'maple:maple_leaves'},
  41. }
  42. }
  43. },
  44. sounds = default.node_sound_leaves_defaults(),
  45. after_place_node = default.after_place_leaves,
  46. })
  47. minetest.register_node("maple:maple_sapling", {
  48. description = S("Maple Sapling"),
  49. drawtype = "plantlike",
  50. visual_scale = 1.0,
  51. tiles = {"maple_sapling.png"},
  52. inventory_image = "maple_sapling.png",
  53. wield_image = "maple_sapling.png",
  54. paramtype = "light",
  55. sunlight_propagates = true,
  56. walkable = false,
  57. on_timer = maple.grow_sapling,
  58. selection_box = {
  59. type = "fixed",
  60. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
  61. },
  62. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  63. attached_node = 1, sapling = 1},
  64. sounds = default.node_sound_leaves_defaults(),
  65. on_construct = function(pos)
  66. minetest.get_node_timer(pos):start(math.random(2400,4800))
  67. end,
  68. on_place = function(itemstack, placer, pointed_thing)
  69. minetest.log("action", S("Maple sapling placed."))
  70. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  71. "maple:maple_sapling",
  72. -- minp, maxp to be checked, relative to sapling pos
  73. -- minp_relative.y = 1 because sapling pos has been checked
  74. {x = -2, y = 1, z = -2},
  75. {x = 2, y = 13, z = 2},
  76. -- maximum interval of interior volume check
  77. 4)
  78. return itemstack
  79. end,
  80. })
  81. default.register_leafdecay({
  82. trunks = {"maple:maple_tree"},
  83. leaves = {"maple:maple_leaves"},
  84. radius = 3,
  85. })