0
0
Fork 0

Add per-element armor groups

This commit is contained in:
Lizzy Fleckenstein 2021-04-29 11:51:06 +02:00
parent 87e41cc9a9
commit 6550e3e8e2
1 changed files with 5 additions and 0 deletions

View File

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