Don't exit the game if a saved GUI has incompatible styles.

Post Reply
JasonC
Filter Inserter
Filter Inserter
Posts: 448
Joined: Tue Mar 22, 2016 3:05 am
Contact:

Don't exit the game if a saved GUI has incompatible styles.

Post by JasonC »

If a GUI is saved with a game, and if the save is loaded but the mod's styles have been changed and are no longer compatible with the saved GUI, the game pops up an error dialog and then just exits completely.

Can it not do this? Can it just print a message to the console then simply not create the element or something?

It would make this a non-issue. Currently it is not really possible to make updates to a mod that make styles incompatible with the old GUI, period, because it completely breaks all previously saved files that saved the old incompatible GUI's in them, and users can therefore never upgrade. Which is kinda no good.
Last edited by JasonC on Wed May 11, 2016 2:24 am, edited 1 time in total.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.

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

Re: Don't exit the game if a saved GUI has incompatible styles.

Post by Rseding91 »

Can you provide a small save (limit map to 50x50) and a sample mod with a single GUI element that reproduces the error? I'll get it taken care of for 0.13 if you can do that.
If you want to get ahold of me I'm almost always on Discord.

JasonC
Filter Inserter
Filter Inserter
Posts: 448
Joined: Tue Mar 22, 2016 3:05 am
Contact:

Re: Don't exit the game if a saved GUI has incompatible styles.

Post by JasonC »

Rseding91 wrote:Can you provide a small save (limit map to 50x50) and a sample mod with a single GUI element that reproduces the error? I'll get it taken care of for 0.13 if you can do that.
Example created at https://github.com/JC3/StyleUpdateExample:
  • style-update-example-1.0.0: The "first" version of a mod, which provides a GUI with a button.
  • style-update-example-2.0.0: The "second" version, where the button and its style have been changed to a checkbox.
  • style-update-example-gui-hidden: A game saved with version 1.0.0 and the GUI hidden.
  • style-update-example-gui-displayed: A game saved with version 1.0.0 and the GUI displayed.
The mod adds a button to the top that says "toggle". Press it to hide/show a frame with another button on it. The button on that frame is the offending button here.


For
instant gratification:

  1. Install version 2.0.0 of the mod.
  2. Load style-update-example-gui-displayed.
  3. The game will produce an error and exit.



The hidden GUI save won't have the issue since the GUI doesn't exist in the save.

A more "realistic" example:
  1. Install version 1.0.0 of the mod.
  2. Start a new game.
  3. Press the "toggle" button in the top left to show the GUI.
  4. Save the game.
  5. Update to version 2.0.0 of the mod.
  6. Load the game.
  7. The game will produce an error and exit.
The differences between 1.0.0 and 2.0.0 are marked in the 2.0.0 source. They are:
There is a workaround, by the way, so you're not completely hosed.

I propose, for 0.13, that the behavior for incompatible styles be identical to the behavior for styles that no longer exist. But just to be clear: Only when loading from saves. The behavior on ".add()" is already different from the save load behavior (it displays the standard Lua error box and also doesn't exit the game) and that should probably remain unchanged because it helps during development.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.

Post Reply

Return to “Implemented mod requests”