acacia.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. function serveressentials.acacia_fixup(pos)
  2. local n1 = minetest.get_node(pos)
  3. if n1.name == "basictrees:acacia_trunk" and n1.param2 >= 0 and n1.param2 <= 3 then
  4. --minetest.chat_send_all('test2')
  5. local n2 = minetest.get_node(vector.add(pos, {x=0,y=-1,z=0}))
  6. if n2.name == "air" then
  7. local positions = {
  8. {pos={x=pos.x-1, y=pos.y-1, z=pos.z-1}, node={name="basictrees:acacia_branch", param2=22}},
  9. {pos={x=pos.x-1, y=pos.y-1, z=pos.z+1}, node={name="basictrees:acacia_branch", param2=21}},
  10. {pos={x=pos.x+1, y=pos.y-1, z=pos.z-1}, node={name="basictrees:acacia_branch", param2=23}},
  11. {pos={x=pos.x+1, y=pos.y-1, z=pos.z+1}, node={name="basictrees:acacia_branch", param2=20}},
  12. }
  13. for k, v in ipairs(positions) do
  14. local n3 = minetest.get_node(v.pos)
  15. --minetest.chat_send_all("test")
  16. if n3.name == "basictrees:acacia_trunk" and n3.param2 >= 0 and n3.param2 <= 3 then
  17. minetest.set_node(vector.add(pos, {x=0,y=-1,z=0}), v.node)
  18. break
  19. end
  20. end
  21. end
  22. end
  23. end
  24. -- The acacia tree schematic-from-sapling needs some help (because of falling-node physics).
  25. function serveressentials.fix_acacia_tree(minp, maxp)
  26. if not minetest.registered_nodes["basictrees:acacia_branch"] then return end
  27. for x = minp.x, maxp.x, 1 do
  28. for y = minp.y, maxp.y, 1 do
  29. for z = minp.z, maxp.z, 1 do
  30. serveressentials.acacia_fixup({x=x, y=y, z=z})
  31. end
  32. end
  33. end
  34. end