acacia.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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="stairs:slope_acacia_trunk_outer", param2=22}},
  9. {pos={x=pos.x-1, y=pos.y-1, z=pos.z+1}, node={name="stairs:slope_acacia_trunk_outer", param2=21}},
  10. {pos={x=pos.x+1, y=pos.y-1, z=pos.z-1}, node={name="stairs:slope_acacia_trunk_outer", param2=23}},
  11. {pos={x=pos.x+1, y=pos.y-1, z=pos.z+1}, node={name="stairs:slope_acacia_trunk_outer", 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. for x = minp.x, maxp.x, 1 do
  27. for y = minp.y, maxp.y, 1 do
  28. for z = minp.z, maxp.z, 1 do
  29. serveressentials.acacia_fixup({x=x, y=y, z=z})
  30. end
  31. end
  32. end
  33. end