mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-12-30 12:40:23 +01:00
Don't overwrite registered crafts
The crafts_table was being initialised to contain only core-registered crafts, but this would overwrite any non-core craft types that had already been registered via unified_inventory.register_craft(). This was especially likely because the crafts_table initialisation runs on a delay, following all normal initialisation. Instead, feed the core-registered crafts into unified_inventory.register_craft().
This commit is contained in:
parent
37d87d6afc
commit
87cfad559b
4
api.lua
4
api.lua
@ -14,16 +14,14 @@ minetest.after(0.01, function()
|
|||||||
table.insert(unified_inventory.items_list, name)
|
table.insert(unified_inventory.items_list, name)
|
||||||
local all_names = rev_aliases[name] or {}
|
local all_names = rev_aliases[name] or {}
|
||||||
table.insert(all_names, name)
|
table.insert(all_names, name)
|
||||||
local all_recipes = {}
|
|
||||||
for _, name in ipairs(all_names) do
|
for _, name in ipairs(all_names) do
|
||||||
local recipes = minetest.get_all_craft_recipes(name)
|
local recipes = minetest.get_all_craft_recipes(name)
|
||||||
if recipes then
|
if recipes then
|
||||||
for _, recipe in ipairs(recipes) do
|
for _, recipe in ipairs(recipes) do
|
||||||
table.insert(all_recipes, recipe)
|
unified_inventory.register_craft(recipe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unified_inventory.crafts_table[name] = all_recipes
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(unified_inventory.items_list)
|
table.sort(unified_inventory.items_list)
|
||||||
|
Loading…
Reference in New Issue
Block a user