dennisjenkins75 / digiline_craftdb

Minetest mod for a digiline queryable database holding all regular and technic crafting recipes.
GNU General Public License v3.0
2 stars 2 forks source link

Item list from `search_items` includes non-creatable items. #15

Open dennisjenkins75 opened 2 years ago

dennisjenkins75 commented 2 years ago

The craftdb provides an API, search_items, that can be asked to return a list of all registered_items that contain a given substring. The intent was to allow this type of query for populating a text_list or similar UI element in a digiline touch screen. However, the list of returned items includes ALL matching items, even items that cannot be crafted or otherwise build via automation.

Example: on pandorabox.io, searching for 'protected_chest' returns the 6 expected protected chests, but also the "colored" variants of the gold chest. These colored variants cannot be made in an autocrafter, furnace nor other; they can only be created by a player interacting with the formspec of an already-placed technic:gold_protected_chest.

Similarly, there are 256 registered digilines:wire_std_00000000, with all combinations of 0s and 1s for the last 8 characters. However, only the all-zeros variant can be crafted, and all others, when dug, return the all-zeros variant. Short of glitches, it is not possible for a player or chest to contain the other 255 digiline wires types (they only exist when a digiline wire is placed and then self-mutates to make connections to adjacent digiline nodes).

It is desirable for the craftdb to filter the list of returned nodes to exclude all matches that cannot be made via crafting, cooking or a technic recipe.

I intend to add this filter by adding an additional boolean flag to its digiline message.

dennisjenkins75 commented 2 years ago

It is already possible to exclude such items by setting group_filter={not_in_creative_inventory=false} in the request to the craftdb. I should not touch the code and just update the README file with another example instead.