Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- core.register_on_dignode(function(pos, node)
- local tool = core.get_wielded_item()
- local wear = tool:get_wear()
- if (wear == 0) then return end
- -- check to see if we're about to break if we mine this node
- -- might not work and TODO
- local wear_about_to_use = 5000
- if (wear >= 65535 - wear_about_to_use) then
- local name = "tool"--tool:get_meta()
- local meta = tool:get_meta()
- print(dump(meta))
- if (meta) then name = meta:get_string("description") or name end
- core.display_chat_message("Your "..name.." is about to break!")
- core.sound_play("default_tool_breaks")
- core.sound_play("default_tool_breaks")
- core.sound_play("default_tool_breaks")
- return true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement