Merge pull request #1 from minetest-technic/master
update to latest version
This commit is contained in:
commit
8a91596940
|
@ -0,0 +1,2 @@
|
|||
*~
|
||||
|
22
README.md
22
README.md
|
@ -1,6 +1,22 @@
|
|||
unified_inventory
|
||||
Unified inventory
|
||||
=================
|
||||
|
||||
Replacement for Minetest creative inventory.
|
||||
Unified Inventory replaces the default survival and creative inventory.
|
||||
It adds a nicer interface and a number of features, such as a crafting guide.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Copyright (C) 2012-2014 Maciej Kasatkin (RealBadAngel)
|
||||
|
||||
Unified inventory code is licensed under the GNU LGPLv2+.
|
||||
|
||||
Licenses for textures:
|
||||
|
||||
VanessaE: (WTFPL)
|
||||
* ui\_group.png
|
||||
|
||||
RealBadAngel: (WTFPL)
|
||||
* Everything else.
|
||||
|
||||
|
||||
Unified Inventory replaces the survival and creative inventory; it also functions as a crafting guide.
|
||||
|
|
21
api.lua
21
api.lua
|
@ -1,18 +1,29 @@
|
|||
|
||||
-- Create detached creative inventory after loading all mods
|
||||
minetest.after(0.01, function()
|
||||
local rev_aliases = {}
|
||||
for source, target in pairs(minetest.registered_aliases) do
|
||||
if not rev_aliases[target] then rev_aliases[target] = {} end
|
||||
table.insert(rev_aliases[target], source)
|
||||
end
|
||||
unified_inventory.items_list = {}
|
||||
for name, def in pairs(minetest.registered_items) do
|
||||
if (not def.groups.not_in_creative_inventory or
|
||||
def.groups.not_in_creative_inventory == 0) and
|
||||
def.description and def.description ~= "" then
|
||||
table.insert(unified_inventory.items_list, name)
|
||||
local recipes = minetest.get_all_craft_recipes(name)
|
||||
if recipes then
|
||||
unified_inventory.crafts_table[name] = recipes
|
||||
else
|
||||
unified_inventory.crafts_table[name] = {}
|
||||
local all_names = rev_aliases[name] or {}
|
||||
table.insert(all_names, name)
|
||||
local all_recipes = {}
|
||||
for _, name in ipairs(all_names) do
|
||||
local recipes = minetest.get_all_craft_recipes(name)
|
||||
if recipes then
|
||||
for _, recipe in ipairs(recipes) do
|
||||
table.insert(all_recipes, recipe)
|
||||
end
|
||||
end
|
||||
end
|
||||
unified_inventory.crafts_table[name] = all_recipes
|
||||
end
|
||||
end
|
||||
table.sort(unified_inventory.items_list)
|
||||
|
|
Loading…
Reference in New Issue