Calling set_filter on a LuaEntity does not visually update the filter slots in an already open entity gui.
What did you do? Call set_filter(1, "iron-plate") from a Lua Snippet with a filter inserter gui open.
What happened? The filter slots on the filter inserter do not visually update to reflect the new filter. The entity preview and in game sprite correctly update.
What did you expect to happen instead? The filter selection slots should always visually match the actual filters
Does it happen always, once, or sometimes? Always
Reproduction steps:
Open entity gui of filter inserter
call entity.set_filter(...)
A save file is provided with a Lua Snippet to accomplish this.
[1.1.81] LuaEntity.set_filter does not update open GUI
[1.1.81] LuaEntity.set_filter does not update open GUI
- Attachments
-
- factorio-current.log
- (6.14 KiB) Downloaded 66 times
-
- filter-inserter-bug.zip
- (1.34 MiB) Downloaded 65 times
Re: [1.1.81] LuaEntity.set_filter does not update open GUI
+1 to this. I was recently using https://mods.factorio.com/mod/FilterHelper and while it's super helpful, it has to close and reopen the GUI to refresh the changed filter because of the behavior described here.
Specifically it would be really nice if the GUI for an opened inserter, splitter, or loader would refresh after https://lua-api.factorio.com/latest/cla ... set_filter is called by a mod on that entity.
I see that this same thing was done in the past for constant combinators and set_signal in viewtopic.php?f=65&t=89218&p=511616 so it'd be awesome to see it done for inserters/splitters/loaders and set_filter too!
Specifically it would be really nice if the GUI for an opened inserter, splitter, or loader would refresh after https://lua-api.factorio.com/latest/cla ... set_filter is called by a mod on that entity.
I see that this same thing was done in the past for constant combinators and set_signal in viewtopic.php?f=65&t=89218&p=511616 so it'd be awesome to see it done for inserters/splitters/loaders and set_filter too!
Re: [1.1.81] LuaEntity.set_filter does not update open GUI
For the sake of completeness I went into a no mod game in 1.1.93 and checked the following.
Starting with a map with the filter inserter, stack filter inserter, splitter, and loader: And then with this lua script in the editor for removing the filter by script:
```lua
local surface = game.player.surface
local entities = surface.find_entities_filtered{ area = area }
for k, entity in pairs(entities) do
entity.set_filter(1, nil)
end
```
Opening the filter inserter and then running the script over it resulted in the GUI being unchanged: Same with the stack filter inserter: Same with the splitter but for it I had to use the `splitter_filter` lua property instead of the `set_filter` function so the script looked like this:
```lua
local surface = game.player.surface
local entities = surface.find_entities_filtered{ area = area }
for k, entity in pairs(entities) do
entity.splitter_filter = nil
end
``` Same with the loader but back to using `set_filter` again: So it would be really cool if writes to https://lua-api.factorio.com/latest/cla ... ter_filter also were reflected in the open GUI too in addition to calls to set_filter.
Starting with a map with the filter inserter, stack filter inserter, splitter, and loader: And then with this lua script in the editor for removing the filter by script:
```lua
local surface = game.player.surface
local entities = surface.find_entities_filtered{ area = area }
for k, entity in pairs(entities) do
entity.set_filter(1, nil)
end
```
Opening the filter inserter and then running the script over it resulted in the GUI being unchanged: Same with the stack filter inserter: Same with the splitter but for it I had to use the `splitter_filter` lua property instead of the `set_filter` function so the script looked like this:
```lua
local surface = game.player.surface
local entities = surface.find_entities_filtered{ area = area }
for k, entity in pairs(entities) do
entity.splitter_filter = nil
end
``` Same with the loader but back to using `set_filter` again: So it would be really cool if writes to https://lua-api.factorio.com/latest/cla ... ter_filter also were reflected in the open GUI too in addition to calls to set_filter.
Re: [1.1.81] LuaEntity.set_filter does not update open GUI
Thanks for the report. This issue is now fixed for 2.0: set_filter(call) for inserter and loader and splitter_filter(write) for splitter were fixed to refresh GUI correctly.