Refresh the GUI for an entity

sparr
Smart Inserter
Smart Inserter
Posts: 1430
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Refresh the GUI for an entity

Post by sparr »

I am modifying the signals for a constant combinator whose GUI is open and that GUI does not show the changes until it's closed and re-opened. I'd like to be able to tell it to refresh.

PS: the alt mode render in the world already refreshes on its own, and so does the mini render in the GUI that shows the entity. The only thing that doesn't update is the rest of the GUI.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Refresh the GUI for an entity

Post by eradicator »

Can you "opened=nil; opened=combinator" force re-open it? Resets the gui position though.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

sparr
Smart Inserter
Smart Inserter
Posts: 1430
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Refresh the GUI for an entity

Post by sparr »

No. That seemingly has no effect. I'm guessing because .opened only applies at the end of the tick processing. What does "work" is doing .opened=nil then waiting for the next tick (which is far more complicated than it should be, new request incoming) to do .opened=combinator. This achieves the goal, but also re-opens my mod's GUI (because _closed and _opened get fired for the thing I just closed and opened, which I guess I could filter for if I'm mid-reopen), and plays the GUI close/open sounds which is annoying.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Refresh the GUI for an entity

Post by Rseding91 »

I've fixed it so setting a signals through the lua API will refresh the set signal (set_signal()) for the next release.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Implemented mod requests”