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

Place to get help with not working mods / modding interface.
Post Reply
jgb
Inserter
Inserter
Posts: 25
Joined: Sat Aug 03, 2019 3:22 pm
Contact:

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

Post 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.
Last edited by jgb on Sun Aug 18, 2019 1:36 pm, edited 1 time in total.

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: Possible to change another mod's settings?

Post 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

jgb
Inserter
Inserter
Posts: 25
Joined: Sat Aug 03, 2019 3:22 pm
Contact:

Re: Possible to change another mod's settings?

Post 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.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Possible to change another mod's settings?

Post 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...
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2919
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Possible to change another mod's settings?

Post 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.

jgb
Inserter
Inserter
Posts: 25
Joined: Sat Aug 03, 2019 3:22 pm
Contact:

Re: Possible to change another mod's settings?

Post 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.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Possible to change another mod's settings?

Post 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.

Post Reply

Return to “Modding help”