[2.x] Storage Chest API support for getting/setting quality on its filter

Things that already exist in the current mod API
billbo99
Fast Inserter
Fast Inserter
Posts: 137
Joined: Fri Nov 02, 2018 9:19 am
Contact:

[2.x] Storage Chest API support for getting/setting quality on its filter

Post by billbo99 »

I've been working on some code to set the filter on storage chests and found no option to set the quality setting of the item in the filter.

https://lua-api.factorio.com/latest/cla ... age_filter

Before 2.0, I would set the filter using the item prototype. However, the 2.x API doc does not hint at how to set the quality.

Code: Select all

storage_chest.storage_filter = item_prototype
The same applies to reading the current filter. You can see the current LuaObject, but no quality information is provided.
ahicks
Inserter
Inserter
Posts: 23
Joined: Sat Jul 13, 2024 10:45 pm
Contact:

Re: [2.x] Storage Chest API support for getting/setting quality on its filter

Post by ahicks »

Another Factorio Access relevant request just wrt registering interest for some of these interface requests. Maybe we can work around this one with bleuprints. (I am assuming it's something one can do in vanilla, which I can't personally check). In general "if the frontend can do it and a mod can't, our players can't do it" is what we kinda have in our situation.
User avatar
LCStark
Fast Inserter
Fast Inserter
Posts: 181
Joined: Thu Jan 28, 2021 5:04 pm
Contact:

Re: [2.x] Storage Chest API support for getting/setting quality on its filter

Post by LCStark »

Use the `set_filter` method:

Code: Select all

entity.set_filter(1, { type="item", name="iron-plate", quality="rare"})
11-17-2024, 00-24-40.png
11-17-2024, 00-24-40.png (33.62 KiB) Viewed 121 times
Edit
This works too:

Code: Select all

entity.storage_filter = { type="item", name="iron-plate", quality="rare"}
And I'm guessing here now, but I'd check if places where you've used ItemPrototype before aren't accepting ItemWithQualityID now.
Post Reply

Return to “Already exists”