removed base_material and changed shape_type to a group list in settings
This commit is contained in:
parent
fabf8cc243
commit
29109bf272
@ -26,8 +26,7 @@ The vision is to get items fast searchable and gettable
|
||||
- 3 dynamic filters + text search field for fast items search
|
||||
- cleanup of inventory trough "delete" field
|
||||
- just click to the item to get it in inventory
|
||||
- Grouping out mass-generated shaped nodes to own group to keep klarity. "shape_type" enhancement required.
|
||||
"shape_type" is implemented already in ![lib_node_shapes modpack](https://forum.minetest.net/viewtopic.php?f=9&t=16740),[carpets](https://github.com/bell07/minetest-carpets). Prepared (locally, not pulled yet till mtg patch is clarified): ts_doors, moreblocks/stairsplus. [minetest_game patch](https://github.com/minetest/minetest_game/pull/1594)
|
||||
- Sort out "mass"-groups to a special "Shaped" category
|
||||
|
||||
## Player page
|
||||
The vision is to get all skins and player customizations visual exposed
|
||||
|
25
cache.lua
25
cache.lua
@ -248,14 +248,33 @@ end
|
||||
-- Fill the cache at init
|
||||
-----------------------------------------------------
|
||||
function cache.fill_cache()
|
||||
for name, def in pairs(minetest.registered_items) do
|
||||
local shape_filter = filter.get("shape")
|
||||
for _name_, _def_ in pairs(minetest.registered_items) do
|
||||
-- special handling for doors. In inventory the item should be displayed instead of the node_a/node_b
|
||||
local def
|
||||
if _def_.groups.door then
|
||||
if _def_.door then
|
||||
def = minetest.registered_items[_def_.door.name]
|
||||
elseif _def_.drop and type(_def_.drop) == "string" then
|
||||
def = minetest.registered_items[_def_.drop]
|
||||
else
|
||||
def = _def_
|
||||
end
|
||||
if not def then
|
||||
minetest.log("[smart_inventory] Buggy door found: ".._def_.name)
|
||||
def = _def_
|
||||
end
|
||||
else
|
||||
def = _def_
|
||||
end
|
||||
|
||||
-- build groups and items cache
|
||||
if def.description and def.description ~= "" and
|
||||
(not def.groups.not_in_creative_inventory or def.base_material) then
|
||||
(not def.groups.not_in_creative_inventory or shape_filter:check_item_by_def(_def_)) then
|
||||
|
||||
-- extended registred filters
|
||||
for _, flt in pairs(filter.registered_filter) do
|
||||
local filter_result = flt:check_item_by_def(def)
|
||||
local filter_result = flt:check_item_by_def(_def_)
|
||||
if filter_result then
|
||||
if filter_result == true then
|
||||
cache.add_to_cache_group(flt.name, def, flt)
|
||||
|
@ -62,8 +62,14 @@ return {
|
||||
["group:food"] = {label = "Nahrung"},
|
||||
|
||||
["group:stair"] = {label = "Treppe"},
|
||||
["group:door"] = {label = "Tür"},
|
||||
["group:fence"] = {label = "Zaun"},
|
||||
["group:slab"] = {label = "Platte"},
|
||||
["group:wall"] = {label = "Mauer"},
|
||||
["group:carpet"] = {label = "Teppich"},
|
||||
["group:micro"] = {label = "Mikro"},
|
||||
["group:panel"] = {label = "Paneel"},
|
||||
["group:slope"] = {label = "Neigung"},
|
||||
|
||||
["type:tool"] = { label = "Werkzeuge" },
|
||||
["type:node"] = { label = "Blöcke" },
|
||||
@ -74,8 +80,7 @@ return {
|
||||
["transluc"] = { label = "Lichtdurchlässig" },
|
||||
["vessel"] = { label = "Behälter" },
|
||||
["eatable"] = { label = "Essbar" },
|
||||
["material"] = { label = "Geformt" },
|
||||
["shape"] = { label = "Form"},
|
||||
["shape"] = { label = "Geformt"},
|
||||
|
||||
["tool"] = {label = false},
|
||||
["tool:full_punch_interval"] = { label = "Verwendungsinterval" },
|
||||
|
@ -62,8 +62,14 @@ return {
|
||||
["group:food"] = {label = "Food"},
|
||||
|
||||
["group:stair"] = {label = "Stair"},
|
||||
["group:door"] = {label = "Door"},
|
||||
["group:fence"] = {label = "Fence"},
|
||||
["group:slab"] = {label = "Slab"},
|
||||
["group:wall"] = {label = "Wall"},
|
||||
["group:carpet"] = {label = "Carpet"},
|
||||
["group:micro"] = {label = "Micro"},
|
||||
["group:panel"] = {label = "Panel"},
|
||||
["group:slope"] = {label = "Slope"},
|
||||
|
||||
["type:tool"] = { label = "Tools" },
|
||||
["type:node"] = { label = "Nodes" },
|
||||
@ -74,8 +80,7 @@ return {
|
||||
["transluc"] = { label = "Translucent" },
|
||||
["vessel"] = { label = "Vessel" },
|
||||
["eatable"] = { label = "Eatable" },
|
||||
["material"] = { label = "Shaped" },
|
||||
["shape"] = { label = "Shape"},
|
||||
["shape"] = { label = "Shaped"},
|
||||
|
||||
["tool"] = {label = false},
|
||||
["tool:full_punch_interval"] = { label = "Punch interval" },
|
||||
|
@ -15,7 +15,11 @@ function doc_addon.is_revealed_item(itemname, playername)
|
||||
else
|
||||
for _, group in pairs(cache.citems[itemname].cgroups) do
|
||||
if group.name == "type:node" then
|
||||
category_id = "nodes"
|
||||
if cache.citems[itemname].cgroups["group:door"] then
|
||||
category_id = "craftitems" -- map back for doc compatibility
|
||||
else
|
||||
category_id = "nodes"
|
||||
end
|
||||
elseif group.name == "type:tool" then
|
||||
category_id = "tools"
|
||||
elseif group.name == "type:craft" then
|
||||
|
22
filter.lua
22
filter.lua
@ -117,20 +117,22 @@ filter.register_filter({
|
||||
})
|
||||
]]
|
||||
|
||||
filter.register_filter({
|
||||
name = "material",
|
||||
filter_func = function(def)
|
||||
return def.base_material
|
||||
end,
|
||||
shortdesc_func = function(self, group)
|
||||
return txt["material"].label.." "..group.name:sub(10)
|
||||
end
|
||||
})
|
||||
local shaped_groups = {}
|
||||
local shaped_list = minetest.setting_get("smart_inventory_shaped_groups") or "carpet,door,fence,stair,slab,wall,micro,panel,slope"
|
||||
if shaped_list then
|
||||
shaped_list:gsub("[^,]+", function(z)
|
||||
shaped_groups[z] = true
|
||||
end)
|
||||
end
|
||||
|
||||
filter.register_filter({
|
||||
name = "shape",
|
||||
filter_func = function(def)
|
||||
return def.shape_type
|
||||
for k, v in pairs(def.groups) do
|
||||
if shaped_groups[k] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -1,2 +1,6 @@
|
||||
#If enabled, the mod will show alternative human readable filterstrings if available.
|
||||
smart_inventory_friendly_group_names (Show “friendly” filter grouping names) bool true
|
||||
|
||||
#List of groups defined for special handling of "Shaped nodes" (Comma separated).
|
||||
#Items in this groups ignores the "not_in_inventory" group and are moved to separate "Shaped" category
|
||||
smart_inventory_shaped_groups (List of groups to be handled as separate) string carpet,door,fence,stair,slab,wall,micro,panel,slope
|
||||
|
Loading…
x
Reference in New Issue
Block a user