Archaegeo / DualUniverseLuaIssues

DualUniverse LUA Issue Tracking
GNU General Public License v3.0
5 stars 0 forks source link

Item ID discovery #53

Open samdeane opened 2 years ago

samdeane commented 2 years ago

Now that we have system.getItem (which is great by the way - thanks for that), we could do with a better way to discover item ids.

For example, I'm building an in-game industry helper, where you can specify an item, and it will tell you what you need to build, how much ore you need, and so on.

Right now if I want to give the user a UI to pick items, I need my own lookup table. That's potentially a big table, and if it is hard-coded in my source, it's fragile and likely to break or be out of date quite often.

I can think of two approaches.

The first is a function system.getItemsMatching(string), which returns a list of items whose localized name includes the string.

The second is a set of functions which lets you obtain lists of items by category - using the same categories as the industry / crafting UI uses in game:

I think both approaches have merit and would be useful in different situations.

ShadowLordAlpha commented 1 year ago

Another possible way would be to have something similar to the bank where we can get the item IDs that the industry is able to create with filters for all items, ones that the industry is able to produce or have schematics for, and ones that we have all items to produce

NQ-Ligo commented 1 year ago

Hummm, why not, I will consider a way to get an extract of the itembank with potential conditions or filters.