Check if tool is about to break and notify the player.

This commit is contained in:
Stefan Vukanović 2017-07-27 13:36:54 +02:00
parent 2a62b23076
commit eac63a4606
2 changed files with 9 additions and 1 deletions

@ -2,3 +2,5 @@
- Fixed bug making Minetest crash when dug nodes exceed 799
13.7.2017
- Only count nodes that spend the tool
27.7.2017
- Check if tool is about to break and notify the player

@ -59,7 +59,13 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
if(digparams.wear > 0) then
dugnodes = dugnodes + 1
end
if(itemstack:get_wear() > 65135) then
minetest.chat_send_player(user:get_player_name(), "Your tool is about to break, comrade!")
minetest.sound_play("default_tool_breaks", {
to_player = user:get_player_name(),
gain = 2.0,
})
end
level = toolranks.get_level(dugnodes)
if lastlevel < level then