Remove now useless search filter
This commit is contained in:
parent
c7987a6c72
commit
ac4a7352fd
6
API.md
6
API.md
|
@ -197,12 +197,12 @@ They can be used like so: `<optional_name> +<filter name>=<value1>,<value2>,<...
|
||||||
Example usages:
|
Example usages:
|
||||||
|
|
||||||
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
|
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
|
||||||
- `wood +groups=flammable +types=node`: search for group `flammable` amongst items which contain
|
- `wood +groups=flammable`: search for group `flammable` amongst items which contain
|
||||||
`wood` in their names AND have a `node` drawtype.
|
`wood` in their names.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- If `optional_name` is omitted, the search filter will apply to all items, without pre-filtering.
|
- If `optional_name` is omitted, the search filter will apply to all items, without pre-filtering.
|
||||||
- The `+groups` and `+types` filters are currently implemented by default.
|
- The `+groups` filter is currently implemented by default.
|
||||||
|
|
||||||
#### `i3.add_search_filter(name, function(item, values))`
|
#### `i3.add_search_filter(name, function(item, values))`
|
||||||
|
|
||||||
|
|
12
init.lua
12
init.lua
|
@ -2742,18 +2742,6 @@ i3.add_search_filter("groups", function(item, groups)
|
||||||
return has_groups
|
return has_groups
|
||||||
end)
|
end)
|
||||||
|
|
||||||
i3.add_search_filter("types", function(item, drawtypes)
|
|
||||||
local t = {}
|
|
||||||
|
|
||||||
for i, dt in ipairs(drawtypes) do
|
|
||||||
t[i] = (dt == "node" and reg_nodes[item] and 1) or
|
|
||||||
(dt == "item" and reg_craftitems[item] and 1) or
|
|
||||||
(dt == "tool" and reg_tools[item] and 1) or nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return #t > 0
|
|
||||||
end)
|
|
||||||
|
|
||||||
--[[ As `core.get_craft_recipe` and `core.get_all_craft_recipes` do not
|
--[[ As `core.get_craft_recipe` and `core.get_all_craft_recipes` do not
|
||||||
return the fuel, replacements and toolrepair recipes, we have to
|
return the fuel, replacements and toolrepair recipes, we have to
|
||||||
override `core.register_craft` and do some reverse engineering.
|
override `core.register_craft` and do some reverse engineering.
|
||||||
|
|
Ŝarĝante…
Reference in New Issue