on_updated: on_tick that works when paused
Posted: Tue Mar 26, 2019 1:27 pm
When using game.tick_paused, I don't understand how to unpause the game after that.
The only delayed entry points that might work that I can find are GUI or key events. Is this true, or am I missing something important?
If not, I propose to add some kind of on_updated event, which works similar to on_tick, except it would only trigger on every 'draw' of the game instead of every update. This would serve 2 purposes:
1. It will keep functioning when the game is game.tick_paused. This way you can run code even when the game is paused withouth any user interaction.
2. Since it would only run every update instead of every tick, it could also help with the problem I was having here: viewtopic.php?f=65&t=65045
Maybe it should be split up into 2 events: on_updated which would work like on_tick but also when paused and on_redrawn which would only trigger when the screen is redrawn similar to described as above.
For the rest of this post, I'll explain my use case:
In factoriomaps, my goal is to generate day and night images that are exactly alike. It's important that these images are taken of the same tick, otherwise this would result in tears between the day and night version all over the map. In 0.16, I had to choose between restarting the game to do day and night separately, which can take a painful amount of time when dealing with a lot of mods, or taking the screenshots 1 tick apart.
In 0.16, my workflow was as follows:
tick 0: set daytime to day.
tick 1: hope the game has rendered, capture all day screenshots, set daytime to night.
tick 2: hope the game has rendered again and capture all night screenshots.
This left me with a day and night version of the capture that were 1 tick apart and thus had tears everywhere.
My hope is that I can use an event like on_updated to follow a similar workflow but while the game is paused.
The only delayed entry points that might work that I can find are GUI or key events. Is this true, or am I missing something important?
If not, I propose to add some kind of on_updated event, which works similar to on_tick, except it would only trigger on every 'draw' of the game instead of every update. This would serve 2 purposes:
1. It will keep functioning when the game is game.tick_paused. This way you can run code even when the game is paused withouth any user interaction.
2. Since it would only run every update instead of every tick, it could also help with the problem I was having here: viewtopic.php?f=65&t=65045
Maybe it should be split up into 2 events: on_updated which would work like on_tick but also when paused and on_redrawn which would only trigger when the screen is redrawn similar to described as above.
For the rest of this post, I'll explain my use case:
In factoriomaps, my goal is to generate day and night images that are exactly alike. It's important that these images are taken of the same tick, otherwise this would result in tears between the day and night version all over the map. In 0.16, I had to choose between restarting the game to do day and night separately, which can take a painful amount of time when dealing with a lot of mods, or taking the screenshots 1 tick apart.
In 0.16, my workflow was as follows:
tick 0: set daytime to day.
tick 1: hope the game has rendered, capture all day screenshots, set daytime to night.
tick 2: hope the game has rendered again and capture all night screenshots.
This left me with a day and night version of the capture that were 1 tick apart and thus had tears everywhere.
My hope is that I can use an event like on_updated to follow a similar workflow but while the game is paused.