[0.15.12] Changing prototypes doesn't fire on_configuration_changed

Bugs that are actually features.
Post Reply
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

[0.15.12] Changing prototypes doesn't fire on_configuration_changed

Post by Optera »

When making recipes use startup mod settings to vary their result, e.g. barrel fluid capacity and stack size, on_configuration_changed does not fire after only changing these startup settings.
That means there is no built in way to reliably call reset_recipes when such a setting was changed for existing games.

on_configuration_changed should fire whenever prototype parameters change.

Alternatively startup settings could have a bool flag "requires_reset_recipes" which when set would make factorio do the recipe reset by itself.
The benefit of this would be not having every mod calling reset_recipes separately.

credomane
Filter Inserter
Filter Inserter
Posts: 278
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

Re: [0.15.12] Changing prototypes doesn't fire on_configuration_changed

Post by credomane »

on_configuration_changed is only fired if a mod is added, removed or the version (in info.json) changes.

I've bit myself in the rear a few times with this in the past while updating mods.

There does need to be something so as to match the defines.events.on_runtime_mod_setting_changed event:

defines.events.on_startup_mod_setting_changed that fires when a saved game is loaded with startup mod settings different than what are in the saved game.
defines.events.on_map_mod_setting_changed that fires when a saved game is loaded (or while playing) the per-save "global" settings are changed by an admin [or the player in sp].

Modding API request is probably where this belongs.

[edit]
The best work-around I can think of is to read the startup and store them inside the mod. Then at some interval check the startup settings against the stored settings and do any needed modifications from there. Not pretty but it should work.

Post Reply

Return to “Not a bug”