From 2a62b23076c4b3661ef89c7920e56d09bb07d815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Vukanovi=C4=87?= Date: Thu, 13 Jul 2017 19:46:18 +0200 Subject: [PATCH] Only count nodes that spend the tool. --- CHANGELOG | 2 ++ init.lua | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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)