functions.lua 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. -- falling nodes go into pocket --
  2. function default.dig_horx(pos, node, digger)
  3. if digger == nil then return end
  4. local np = {x = pos.x + 1, y = pos.y, z = pos.z,}
  5. local nn = minetest.get_node(np)
  6. if nn.name == node.name then
  7. minetest.node_dig(np, nn, digger)
  8. end
  9. end
  10. function default.dig_horx2(pos, node, digger)
  11. if digger == nil then return end
  12. local np = {x = pos.x - 1, y = pos.y, z = pos.z,}
  13. local nn = minetest.get_node(np)
  14. if nn.name == node.name then
  15. minetest.node_dig(np, nn, digger)
  16. end
  17. end
  18. function default.dig_horz(pos, node, digger)
  19. if digger == nil then return end
  20. local np = {x = pos.x, y = pos.y, z = pos.z + 1,}
  21. local nn = minetest.get_node(np)
  22. if nn.name == node.name then
  23. minetest.node_dig(np, nn, digger)
  24. end
  25. end
  26. function default.dig_horz2(pos, node, digger)
  27. if digger == nil then return end
  28. local np = {x = pos.x , y = pos.y, z = pos.z - 1,}
  29. local nn = minetest.get_node(np)
  30. if nn.name == node.name then
  31. minetest.node_dig(np, nn, digger)
  32. end
  33. end