Punchwear (improved) (#8959)

This commit is contained in:
sfan5 2019-09-22 22:12:21 +02:00 committed by Nils Dagsson Moskopp
parent e885b6b9bb
commit 598a344d97
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 12 additions and 0 deletions

View File

@ -256,6 +256,18 @@ function core.register_tool(name, tooldef)
end
-- END Legacy stuff
-- This isn't just legacy, but more of a convenience feature
local toolcaps = tooldef.tool_capabilities
if toolcaps and toolcaps.punch_attack_uses == nil then
for _, cap in pairs(toolcaps.groupcaps or {}) do
local level = (cap.maxlevel or 0) - 1
if (cap.uses or 0) ~= 0 and level >= 0 then
toolcaps.punch_attack_uses = cap.uses * (3 ^ level)
break
end
end
end
core.register_item(name, tooldef)
end