[2.1.9] Cannot create a new filter on deconstruction planner using set_entity_filter

Bugs which we just recently fixed in our development version and will reach you in the next release.
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Fri Mar 16, 2018 4:54 am
Contact:

[2.1.9] Cannot create a new filter on deconstruction planner using set_entity_filter

Post by BurninSun »

Some time during 2.0, LuaItem::set_entity_filter (and ::set_tile_filter) were changed such that if the given index doesn't exist, it generates an error "Index out of bounds". The only way to use these 2 functions is to call LuaItem::entity_filters (or ::item_filters) with an entire array of filters, then ::set_entity_filter is able to change a filter at an existing index.

The result is that there is no way to add a new index to a deconstruction planner without using ::entity_filters to write the entire array of existing filters, plus adding any new indexes.

::set_entity_filter (and ::set_tile_filter) should be usable with arbitrary indexes to extend the existing filter count to that index without modifying existing filters.

Code: Select all

/c stack = game.create_inventory(1)[1]
/c stack.set_stack{name="deconstruction-planner", count=1}
/c stack.set_entity_filter(1, "transport-belt")
Results in Error: Index out of bounds

Code: Select all

/c stack.entity_filters = {"pipe"}
/c stack.set_entity_filter(1, "transport-belt")
Works as expected.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17134
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.9] Cannot create a new filter on deconstruction planner using set_entity_filter

Post by Rseding91 »

Thanks for the report. This was noticed and fixed internally a few days ago. It will be in the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”