overrides.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- override minetest.node_dig
  2. local old_node_dig = minetest.node_dig
  3. function minetest.node_dig(pos, node, digger)
  4. if digger ~= nil then
  5. local player = digger:get_player_name()
  6. if physio_stress.exhausted_dig[player] ~= nil then
  7. local dig_change=physio_stress.exhausted_dig[player]
  8. if math.random(1,dig_change) == 1 then
  9. return old_node_dig(pos, node, digger)
  10. else
  11. return
  12. end
  13. else
  14. return old_node_dig(pos, node, digger)
  15. end
  16. else
  17. return old_node_dig(pos, node, digger)
  18. end
  19. end
  20. local old_item_place_node = minetest.item_place_node
  21. function minetest.item_place_node(itemstack, placer, pointed_thing)
  22. if placer ~= nil then
  23. local player = placer:get_player_name()
  24. if physio_stress.exhausted_build[player] ~= nil then
  25. local build_change=physio_stress.exhausted_build[player]
  26. if math.random(1,build_change) == 1 then
  27. return old_item_place_node(itemstack, placer, pointed_thing)
  28. else
  29. return
  30. end
  31. else
  32. return old_item_place_node(itemstack, placer, pointed_thing)
  33. end
  34. else
  35. return old_item_place_node(itemstack, placer, pointed_thing)
  36. end
  37. end