Save mod settings even when disabled

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
GeneralMaximus
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed May 17, 2017 9:31 am
Contact:

Save mod settings even when disabled

Post by GeneralMaximus »

TL;DR
Could we make the new thing where mods can add configurable options save settings when the mod is disabled?
What ?
Currently, if you disable a mod any configurable keybinds or settings it adds lose their values, and revert to default upon enabling the mod again.
Would it be possible to save those settings even if the mod is disabled, and only delete them if the mod is deleted, so when you enable it again all your settings are right there as you left them?
Why ?
I imagine I'm not the only one who doesn't always play with the same set of mods.
When playing multiplayer with friends I disable some and enable others, and vice versa when playing solo.
However, when doing so I have to go into options and reset all the settings each time, because they lose their values. Which is mildly irritating.
If they could be saved even with the mod disabled, it'd lead to a bit less frustration on my part and presumably that of others who do the same thing.
Especially when Factorio's mod support is so robust compared to so many other games out there, it just seems like a logical thing to have.

factoriouzr
Filter Inserter
Filter Inserter
Posts: 660
Joined: Sat Jun 06, 2015 2:23 am
Contact:

Re: Save mod settings even when disabled

Post by factoriouzr »

+1

I also posted this issue as well. It almost makes the configuraiton for mods useless, because as soon as you disable the mod, all the settings are lost. This is very common to happen and it happens for many reasons. One obvious one is playing multiple games with different mods enabled. This is also likely to happen if you play with friends as each game takes a long time to finish in Factorio, so it's more likely to have multiple games going at the same time.

I think the settings should persist and only be deleted when the mod is deleted, and I also think that mod settings should be saved along with the saved game, so that you can have multiple games going using the same mods but with different settings. The way this would work is if you hit the sync mods button when loading a game, your current mod settings would be set to that of the save, if you don't hit this button then your current mod settings will be used for the loaded save. There should be a checkbox in the sync dialog to check and uncheck which mod settings you want to sync with the save and which you don't (same as how enabling and disabling mods works now).

GeneralMaximus
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed May 17, 2017 9:31 am
Contact:

Re: Save mod settings even when disabled

Post by GeneralMaximus »

I was looking around today and found something. As a workaround, copy or rename the mod-settings.json file in %appdata%/roaming/factorio before changing settings or disabling mods and that'll preserve settings- just copy it back next time you want to play with those settings. Would still be better to have it be automatically preserved somehow though. The idea of tying it to individual save files is a good one, I think, cause even with the same mods you may want to play games with different settings. As an example I typically play solo with biters disabled and the setting in Bob's mods to reintroduce alien artifacts also disabled, but when playing with friends who like fighting aliens, that gets turned back on.

Roxor128
Fast Inserter
Fast Inserter
Posts: 165
Joined: Sun Oct 02, 2016 9:48 am
Contact:

Re: Save mod settings even when disabled

Post by Roxor128 »

One way you could do it would be to have a "MyMod_0.1.0.cfg" file containing the mod's configuration which sits alongside "MyMod_0.1.0.zip" in the game's mods directory and is created automatically by the game the first time you change that mod's settings from the defaults.

GeneralMaximus
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed May 17, 2017 9:31 am
Contact:

Re: Save mod settings even when disabled

Post by GeneralMaximus »

Roxor128 wrote:One way you could do it would be to have a "MyMod_0.1.0.cfg" file containing the mod's configuration which sits alongside "MyMod_0.1.0.zip" in the game's mods directory and is created automatically by the game the first time you change that mod's settings from the defaults.
That makes it global though, rather than being able to save different settings for different configurations as suggested in the second post. I think tying it to save files and having the sync mods to save function also sync applicable mod settings is a better idea, and it wouldn't be too hard I think. Just embed the same stuff that's currently in that mod settings file I mentioned into the save file somewhere and have the sync function compare the save file's version to the game's currently active one in the same way it presumably does with the list of active mods.

Roxor128
Fast Inserter
Fast Inserter
Posts: 165
Joined: Sun Oct 02, 2016 9:48 am
Contact:

Re: Save mod settings even when disabled

Post by Roxor128 »

GeneralMaximus wrote:
Roxor128 wrote:One way you could do it would be to have a "MyMod_0.1.0.cfg" file containing the mod's configuration which sits alongside "MyMod_0.1.0.zip" in the game's mods directory and is created automatically by the game the first time you change that mod's settings from the defaults.
That makes it global though, rather than being able to save different settings for different configurations as suggested in the second post.
Well, there's no reason you couldn't include a number of presets within that config file. Something like this:

Code: Select all

[preset_last_used]
Value1=true
Value2=0.3

[preset_plentiful]
Value1=true
Value2=0.9

[preset_off]
Value1=false
Value2=0.0

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Save mod settings even when disabled

Post by JohnyDL »

Another way to do it is getting/allowing the mods to save and load their own configurations, then

Code: Select all

load defaults
if usersettingsfile.exists
  load usersettingsfile
end
don't know if mods have the permissions to write to the hard disk though.

This way the settings are saved per user which is most commonly what people want. And if you have multiple modpacks with the same mod and different keybinds since the settings are kept in the modpack.zip rather than globally they're independant. And when you want to transfer/backup that's a copy paste command. And factorio doesn't have to internally track legacy keybinds just in case when a mod is used once or when a mod has stopped being used and deleted. And if the mod gets a new update with new controls since it loads the defaults then loads the file any new commands will be at default settings and the user's commands over writes the rest. Everyone wins.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Save mod settings even when disabled

Post by ssilk »

What I see with this suggestion is, that there are concurring interests:
- Player wants to keep previous settings
- Player wants to decide, if or if not other config is loaded
- Player don't want to do this decision every time and for every mod, the handling should "read his mind".
- Modder wants to provide some useful defaults
- Modder don't want to handle edge cases, for example when the version of the old config is too old to be loaded.
- Devs have to keep security reasons in mind (the reason, why mods can only save files into it's own space and are not able to load data from disk.)
- Devs have to bring out a configuration-handling, which is good enough, so that the modders will use it. So it should be a very limited first version, that is save enough to use it without care.
- On the other hand they don't want to limit such a config-handling too much, to make things possible, which are not direct use-case.


In that sense I recommend to make a new suggestion, which brings all that (and more of what I haven't thought yet) into balance.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Save mod settings even when disabled

Post by JohnyDL »

ssilk wrote:What I see with this suggestion is, that there are concurring interests:
- Player wants to keep previous settings
- Player wants to decide, if or if not other config is loaded
- Player don't want to do this decision every time and for every mod, the handling should "read his mind".
- Modder wants to provide some useful defaults
- Modder don't want to handle edge cases, for example when the version of the old config is too old to be loaded.
- Devs have to keep security reasons in mind (the reason, why mods can only save files into it's own space and are not able to load data from disk.)
- Devs have to bring out a configuration-handling, which is good enough, so that the modders will use it. So it should be a very limited first version, that is save enough to use it without care.
- On the other hand they don't want to limit such a config-handling too much, to make things possible, which are not direct use-case.


In that sense I recommend to make a new suggestion, which brings all that (and more of what I haven't thought yet) into balance.
Some are sound conflicting but are not :P
Keep previous settings (game to game no mod loading) and "mind reading" seem to be the same suggestion
Choose previous settings vs default (when reloading a mod) pick and choose when it's important

the settings file could be a list of keybinds and (including modifiers) as just an array of mostly -1s for ignore, so a=-1, b=-1, ... alt+a = -1, ... ctrl + alt + shift + tab = -1 for all the keybinds that are permitted then these may be set to function 1, function 2, ect... the mod then gets an event keypressed(VALUE) and uses that value to pick what to do, when changing the settings you can then make all the keybinds = -1 to disable them, or set multiple to the same function (like direction arrows and WSAD both being direction of movement in like all games).

The file, basically a list of numbers is secure against data execution and not a problem for factorio to save to disk.
When loading the files can effectively cascade, a 0 in the user save file is a pass through from default, a -1 is a reset and ignore (when removing keybinds) or a positive integer to set the keybind to issue a command as normal.
Simple for Modders, Event detects keybind and the modder just does a select/if-elseif statement to decide what internal function to call, then each keybind can be requested to factorio's settings page in much the same way as present (I'd hope)
Expandable, if the Devs want to allow the use of new keys add them onto the list, if they want to disable them can be marked NULL in the game code and noted to modders to not set this as default as it'll be ignored.
Backwards compatible, never lose keybinds unless totally disabled by NULL and even that doesn't change the structure of the file, an update following a disabled key combination will allow a new default to be set by the mod as an update without resetting all keybinds to default
Default can just be the same file in effect but just loaded first as I suggested previously and user settings overwrite this

Post Reply

Return to “Ideas and Suggestions”