diff --git a/CHANGELOG b/CHANGELOG index 47250a7..d011559 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,2 +1,4 @@ 12.7.2017 - Fixed bug making Minetest crash when dug nodes exceed 799 +13.7.2017 +- Only count nodes that spend the tool diff --git a/init.lua b/init.lua index cddb45d..0e60a59 100644 --- a/init.lua +++ b/init.lua @@ -55,8 +55,10 @@ function toolranks.new_afteruse(itemstack, user, node, digparams) local dugnodes = tonumber(itemmeta:get_string("dug")) or 0 -- Number of nodes dug local lastlevel = tonumber(itemmeta:get_string("lastlevel")) or 1 -- Level the tool had -- on the last dig - - dugnodes = dugnodes + 1 + -- Only count nodes that spend the tool + if(digparams.wear > 0) then + dugnodes = dugnodes + 1 + end level = toolranks.get_level(dugnodes)