mirror of
https://github.com/lisacvuk/minetest-toolranks.git
synced 2025-07-03 16:40:39 +02:00
Check if tool is about to break and notify the player.
This commit is contained in:
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
|
||||
|
Reference in New Issue
Block a user