1
0
mirror of https://github.com/lisacvuk/minetest-toolranks.git synced 2024-11-14 14:00:21 +01:00

Only count nodes that spend the tool.

This commit is contained in:
Stefan Vukanović 2017-07-13 19:46:18 +02:00
parent 61fde54efc
commit 2a62b23076
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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)