Page 1 of 1

[Resolved]Possible to change another mod's settings?

Posted: Sat Aug 17, 2019 6:21 am
by jgb
For example, in the oberhaul mod, the expectation is that the setting under "Bob's Assembling machines mod" for "Electrolysers" will be disabled. Is it possible to do this from the API?

If not, what would be a workaround to prevent issues from happening due to incorrect settings? For example, if "Electrolysers" is left enabled, then Steel processing cannot be researched due to missing the "Electrolysis 1" tech-dependency.

Re: Possible to change another mod's settings?

Posted: Sat Aug 17, 2019 7:35 am
by PyroFire
yes use settings-updates.lua and settings-final-fixes.lua

https://lua-api.factorio.com/latest/Data-Lifecycle.html

also you can set the value of settings in a control.lua

Re: Possible to change another mod's settings?

Posted: Sat Aug 17, 2019 3:50 pm
by jgb
Thanks.

Could you point me to an example of a mod that actually does this? I've checked a few now, and don't see any examples of this actually being implemented.

I saw Warptorio 2 had these files, but they are blank.

Re: Possible to change another mod's settings?

Posted: Sun Aug 18, 2019 6:00 am
by eradicator
You can not "change" the settings *value* of another mods settings. What you can do is change the acceptable value range. But as you seem to be dealing with a boolean setting (checkbox?) you're out of luck as those do not have a value range. You could fool yourself into thinking that changing the default_value is sufficient, but that will be ignored if the user ever changes the setting manually.

Your only options are:
A) A modding interface request to support "allowed_values" on bool_setting.
B) Ask bob to detect the presence of your mod on his side. (You lose control over the behavior.)
C) Write your code in a way that doesn't depend on things you don't control...

Re: Possible to change another mod's settings?

Posted: Sun Aug 18, 2019 6:39 am
by Optera
Relying on other mod settings to have a certain value is bound to break at some point.
I'd go with eradicators option C, write your mod so it works regardless of other mods. In your case check if the tech exists otherwise either create it yourself or better use a different tech dependency or none.

Re: Possible to change another mod's settings?

Posted: Sun Aug 18, 2019 1:31 pm
by jgb
Okay, thanks for the replies. Based on all the implementations I've seen of various mods, it looks like that's how most people do it anyway. Or they release a modpack like Seablock.

Re: Possible to change another mod's settings?

Posted: Mon Aug 19, 2019 3:53 am
by slippycheeze
jgb wrote:
Sun Aug 18, 2019 1:31 pm
Okay, thanks for the replies. Based on all the implementations I've seen of various mods, it looks like that's how most people do it anyway. Or they release a modpack like Seablock.
The best way to do this is to talk to the developer of the other mod. Cooperation is far and away the best strategy. Most people are very happy to work with you rather than against you in making things work.