check groupcaps[].uses for nil

master
Buckaroo Banzai 2021-09-29 21:52:58 +02:00 committed by GitHub
parent 8010feb5bf
commit 568944bc87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

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