From 568944bc87ee7d02196cc5edbd98d97f13f558a0 Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Wed, 29 Sep 2021 21:52:58 +0200 Subject: [PATCH] check groupcaps[].uses for nil --- init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index e44aea8..8e8ecc6 100644 --- a/init.lua +++ b/init.lua @@ -122,9 +122,11 @@ function toolranks.new_afteruse(itemstack, user, node, digparams) caps.punch_attack_uses = caps.punch_attack_uses and (caps.punch_attack_uses * use_multiplier) for _,c in pairs(caps.groupcaps) do - c.uses = c.uses * use_multiplier - for i,t in ipairs(c.times) do - c.times[i] = t / speed_multiplier + if c.uses then + c.uses = c.uses * use_multiplier + for i,t in ipairs(c.times) do + c.times[i] = t / speed_multiplier + end end end itemmeta:set_tool_capabilities(caps)