[0.15] Mod setting/config interface - give your input

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by bobingabout »

Mod sort order is based on the name of a mod.

I'm not sure how to decide the order either, probably just alphabetical of the internal mod name.

in any case, all settings of a mod will be grouped together, sorted by the setting's order tag, or setting's name if the order tag doesn't exist.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by moon69 »

Ha ha!!! It's all the many Bob's settings that are pushing mine right to the bottom :P
Not concerned about it for release, but during development/testing I'm frequently having to scroll to the bottom to change/check options.

Sorting doesn't seem to based on internal or localised mod-name.

No big deal though... just curious.
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 302
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by justarandomgeek »

Doesn't anyone read the docs?
Factorio sorts mods first by dependencies then by natural sort order accounting for case (https://en.wikipedia.org/wiki/Natural_sort_order).
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by moon69 »

Thanks - makes sense!

I've looked at that Data Lifecycle page many times lately... but somehow missed the very top line :oops:
admo
Inserter
Inserter
Posts: 27
Joined: Tue Jun 28, 2016 1:07 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by admo »

I cannot solve why my mod setting is showing up in the UI as an unknown key. I tried to copy the simplest example I could find, Cardinal, but I don't understand what it is doing differently.

I added a settings.lua file and in it I placed this code:

Code: Select all

data:extend({
   {
	type = "bool-setting",
	name = "research-causes-evolution-all-techs-equal",
	setting_type = "startup",
	default_value = 0,
	order = "a",
   }
})
Seemingly this should be enough to get my key to show up in the GUI but in the main menu under options->mods I instead have a checkbox titled:

Code: Select all

Unknown key:"research-causes-evolution-all-techs-equal" 
Does anyone have advice or further instructions aside from the first post of this thread?
User avatar
mickael9
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Mar 14, 2016 4:04 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by mickael9 »

The setting name is only an identifier, you need to define an actual name for it in the locale (translation) files, eg, in locale/en/base.cfg:

Code: Select all

[mod-setting-name]
research-causes-evolution-all-techs-equal=Setting name here

[mod-setting-description]
research-causes-evolution-all-techs-equal=Optional setting description
admo
Inserter
Inserter
Posts: 27
Joined: Tue Jun 28, 2016 1:07 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by admo »

mickael9 wrote:The setting name is only an identifier, you need to define an actual name for it in the locale (translation) files, eg, in locale/en/base.cfg:

Code: Select all

[mod-setting-name]
research-causes-evolution-all-techs-equal=Setting name here

[mod-setting-description]
research-causes-evolution-all-techs-equal=Optional setting description
This was the solution, thank for the help.
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by moon69 »

My mods "Startup" settings are resetting to default whenever I increase the mod version... do I need to handle this in migration or something?

The "Map" settings seem to remain though.
User avatar
Xerus
Burner Inserter
Burner Inserter
Posts: 19
Joined: Wed Jul 19, 2017 8:44 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Xerus »

Wow it has taken me forever to find this essential thread!
Please add it to the API documentation, I think i will add something on the wiki for this.
gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Sync startup mod options with save

Post by gheift »

Hi,

I don't know if it was already requested, but I would like to restore the startup settings of the mods from a save file. If I play e.g. with bobs, angels etc. there are many options, which alter the prototypes. If I change them for another game I want to restore these settings for the older save. Just like the "sync mods" button in the load dialog, just for the options.

Thanks,
Gerhard
Rseding91
Factorio Staff
Factorio Staff
Posts: 14280
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Rseding91 »

So, it's about that time again and I've got some time I want to put towards this. Now that mod devs have had time to use mod settings what do you guys think are the main things that should be improved with them?
If you want to get ahold of me I'm almost always on Discord.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Nexela »

On the more "complicated" ends sliders and multiple selection listboxes would be nice. Also being able to add a simple divider bar type gui between settings would be nice.
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Bilka »

It would be nice if dropdowns could be translated using localised strings. Since atm you get the value of dropdows as a string this obviously wouldn't work. So perhaps add another type called localised dropdown and then make it work like the mod gui dropdowns: Array of localised strings for the options, and selected_index as the value that you can then read.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Arch666Angel »

Some if..then logic that shows on the GUI, so some e.g. selection boxes are greyed out until you enable the main button. (example: enable infinite ore, then enabling/disabling individual ore are selectable)
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by eradicator »

Bilka wrote:It would be nice if dropdowns could be translated using localised strings.
+10 for localizable dropdowns. English string dropdowns are just not an option in e.g. a Japanese locale.

Code: Select all

[mod-setting-string]
stringvalueone=Value One
string-value-two=Value Two
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.
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by quyxkh »

Have mod settings changes drive `on_configuration_changed`, or add `on_mod_settings_changed` to the script api? I suspect `settings.global.my_setting_name.value` drives table creation every time, certainly updating the value via script (properly) doesn't work.
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Bilka »

quyxkh wrote:Have mod settings changes drive `on_configuration_changed`, or add `on_mod_settings_changed` to the script api? I suspect `settings.global.my_setting_name.value` drives table creation every time, certainly updating the value via script (properly) doesn't work.
shouldn't http://lua-api.factorio.com/latest/even ... ng_changed be what you want?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by quyxkh »

Should be and is, and I'm leaving my body to neuroscience so they can figure out out how exactly this game gives me such an intense case of the blind spots.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by darkfrei »

Is it possible by mod settings to read data.raw? It would be nice to get some information from it, as example is mod with disabling of some biomes (vanilla and from _all_ mods), disabling some recipes or weapons.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14280
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15] Mod setting/config interface - give your input

Post by Rseding91 »

darkfrei wrote:Is it possible by mod settings to read data.raw? It would be nice to get some information from it, as example is mod with disabling of some biomes (vanilla and from _all_ mods), disabling some recipes or weapons.
No, the nature of settings means they can't have access to the data stage otherwise they wouldn't be deterministic in multiplayer.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding discussion”