xdecor - fix undefined detection of 3d_armor and add support for repair of

* backported 9f4002b749
* backported 9f4002b749
This commit is contained in:
mckaygerhard 2023-06-11 19:46:53 -04:00
parent 7a452c8d48
commit 942dcf90e4
2 changed files with 20 additions and 6 deletions

View File

@ -2,6 +2,8 @@
xdecor = {}
local modpath = minetest.get_modpath("xdecor")
local ar_api = minetest.get_modpath("3d_armor")
-- Intllib
local S
@ -18,16 +20,16 @@ else
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
end
end
xdecor.S = S
xdecor.reparaible_tools = {"pick", "axe", "shovel", "sword"}
xdecor.reparaible_tools = {"pick", "axe", "shovel", "hoe"}
dofile(modpath .. "/handlers/animations.lua")
dofile(modpath .. "/handlers/helpers.lua")

View File

@ -46,6 +46,18 @@ end
function workbench:repairable(stack)
if custom_repairable[stack] then return true end
if ar_api then
for _, t in ipairs({
"armor_head",
"armor_torso",
"armor_legs",
"armor_feet",
"armor_shield",
}) do
if minetest.get_item_group(stack, t) then return true end
end
end
for _, t in ipairs(repairable_tools) do
if stack:find(t) then
return true