xdecor - crash avoiting: Added further sanity check and update formspecs

* update xdecir minenux up to 20230611
* backporting https://notabug.org/minenux/minetest-mod-xdecor/commit/3e0ca1304d454297739d6f8>
* backporting https://github.com/0siribix/xdecor/commit/c7e756afc7d246817209c415c6e9a9dda533>
* backporting https://github.com/0siribix/xdecor/commit/3823fce1e05a9472e7cf798c8346ba95ead1>
* backporting 9f4002b749
stable-5.2
mckaygerhard 2023-06-11 19:55:18 -04:00
parent 5452ce0dda
commit 7c7e763942
4 changed files with 30 additions and 14 deletions

View File

@ -41,7 +41,7 @@ For information check [../README.md](../README.md)
| weather | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | |
| wool | https://codeberg.org/minenux/minetest-mod-wool | https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a | [wool/README.md](wool/README.md) |
| xpanes | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | |
| xdecor | https://codeberg.org/minenux/minetest-game-xdecor | https://codeberg.org/minenux/minetest-game-xdecor/commit/f6d0f0b2a5c1d435217bb3409a76da9eb36fe889 | [xdecor/README.md](xdecor/README.md) |
| xdecor | https://codeberg.org/minenux/minetest-game-xdecor | https://codeberg.org/minenux/minetest-game-xdecor/commit/cd0c35b8c58153f7c353b5dbfac35e524fa0ea18 | [xdecor/README.md](xdecor/README.md) |
The default mod was splitted now sethome and player_api are mods, binoculars from v5 are
just separate privilegies for zoom, butterflies and fireflies from v5 can be set

View File

@ -2,6 +2,7 @@
xdecor = {}
local modpath = minetest.get_modpath("xdecor")
local ar_api = minetest.get_modpath("3d_armor")
-- Intllib
local S
@ -27,7 +28,7 @@ else
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

@ -108,20 +108,23 @@ function enchanting.fields(pos, _, fields, sender)
local tool = inv:get_stack("tool", 1)
local mese = inv:get_stack("mese", 1)
local orig_wear = tool:get_wear()
local mod, name = tool:get_name():match("(.*):(.*)")
local enchanted_tool = (mod or "") .. ":enchanted_" .. (name or "") .. "_" .. next(fields)
if tool and tool:get_name() and allowed_tools[tool:get_name()] then
local mod, name = tool:get_name():match("(.*):(.*)")
local enchanted_tool = (mod or "") .. ":enchanted_" .. (name or "") .. "_" .. next(fields)
if mese:get_count() >= mese_cost and reg_tools[enchanted_tool] then
minetest.sound_play("xdecor_enchanting", {
to_player = sender:get_player_name(),
gain = 0.8
})
if mese:get_count() >= mese_cost and reg_tools[enchanted_tool] then
minetest.sound_play("xdecor_enchanting", {
to_player = sender:get_player_name(),
gain = 0.8
})
tool:replace(enchanted_tool)
tool:add_wear(orig_wear)
mese:take_item(mese_cost)
inv:set_stack("mese", 1, mese)
inv:set_stack("tool", 1, tool)
tool:replace(enchanted_tool)
tool:add_wear(orig_wear)
mese:take_item(mese_cost)
inv:set_stack("mese", 1, mese)
inv:set_stack("tool", 1, tool)
end
enchanting.formspec(pos)
end
end

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