Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. core.register_on_dignode(function(pos, node)
  2. local tool = core.get_wielded_item()
  3. local wear = tool:get_wear()
  4. if (wear == 0) then return end
  5. -- check to see if we're about to break if we mine this node
  6. -- might not work and TODO
  7. local wear_about_to_use = 5000
  8. if (wear >= 65535 - wear_about_to_use) then
  9. local name = "tool"--tool:get_meta()
  10. local meta = tool:get_meta()
  11. print(dump(meta))
  12. if (meta) then name = meta:get_string("description") or name end
  13. core.display_chat_message("Your "..name.." is about to break!")
  14. core.sound_play("default_tool_breaks")
  15. core.sound_play("default_tool_breaks")
  16. core.sound_play("default_tool_breaks")
  17. return true
  18. end
  19. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement