order of mods in gui

Place to get help with not working mods / modding interface.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

order of mods in gui

Post by binbinhfr »

Hi,

is there a way to force a mod (let's say a "clock") to be the first one at the left in the gui.top row ?
Or to manage mod display order in general ?

thanks for your help.
My mods on the Factorio Mod Portal :geek:
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: order of mods in gui

Post by DaveMcW »

You can force a mod to the right, by making it depend on all the mods before it.

I think eventually the modders will agree to cooperate and make a gui manager mod, but we are not there yet.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: order of mods in gui

Post by Supercheese »

DaveMcW wrote:I think eventually the modders will agree to cooperate and make a gui manager mod, but we are not there yet.
I'm intrigued by this statement; how would such a mod work?
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: order of mods in gui

Post by DaveMcW »

Every mod does the following:

1. Implement the show_gui() and hide_gui() remote calls.
2. Register itself with the gui manager mod.

The gui manager then calls show_gui() and hide_gui() to sort the mods.

The hardest part of the project is writing sample code and tech support to convince modders to join.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: order of mods in gui

Post by binbinhfr »

In https://wiki.factorio.com/index.php?tit ... g_overview you can read :
The mods overview is given in the mods/mod-list.json file. The ordering of the mods matters. Mods later in the list have access to prototypes defined by earlier mods. Also when running mod scripts the scripts of earlier mods are run before the latter ones. The mods settings are loaded on the game startup. Only the mods with "enable" value will be used for the run of the game. The game discovers new mods (directories) that are not in the list and automatically adds them to the list to the end ordered by name. There is a setting value to automatically enable auto discovered mods in Other settings. The mod settings can be changed via the Mods Menu (Main Menu > Mods). You can enable / disable the mods and change their ordering. The settings will apply after the game restart.
So, the order in this file has a meaning. But more for charging prototypes.
And I am not sure that this order is conserved when you toggle mods on/off because this file is then rewrittent by factorio.

But maybe in LuaGuiElement.add{type=…, name=…, style=…} we could have a variable {insert=..} with a value "first" or "end", that would insert the guielement at the beginning or at the end of the parent's list ? By default, this value should be "end" to keep the original behaviour.
My mods on the Factorio Mod Portal :geek:
Post Reply

Return to “Modding help”