Add per-element armor groups

This commit is contained in:
Elias Fleckenstein 2021-04-29 11:51:06 +02:00
parent 87e41cc9a9
commit 6550e3e8e2

@ -96,6 +96,7 @@ function mcl_armor.register_set(def)
local textures = def.textures or {}
local previews = def.previews or {}
local durabilities = def.durabilities or {}
local element_groups = def.element_groups or {}
for name, element in pairs(mcl_armor.elements) do
local itemname = element.name .. "_" .. def.name
@ -111,6 +112,10 @@ function mcl_armor.register_set(def)
groups.mcl_armor_uses = (durabilities[name] or math.floor(def.durability * element.durability)) + 1
groups.enchantability = def.enchantability
for k, v in pairs(element_groups) do
groups[k] = v
end
minetest.register_tool(itemstring, {
description = S(def.description .. " " .. (descriptions[name] or element.description)),
_doc_items_longdesc = mcl_armor.longdesc,