mirror of
https://github.com/lisacvuk/minetest-toolranks.git
synced 2024-11-30 11:03:50 +01:00
Check if tool is about to break and notify the player.
This commit is contained in:
parent
2a62b23076
commit
eac63a4606
@ -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
|
8
init.lua
8
init.lua
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user