GUI Manager

by unhott

Manage GUIs added by mods

Utilities
7 months ago
0.17 - 1.1
13.4K

i Question: reorder

3 years ago

Is it possible to add re-order ability?
Could we move some buttons/UI elements on left/top of other?
I want reorder buttons, or some elements, but keep them shown.
For example,
first - all buttons
then - all texts, panels and etc.

Also, can we move elements between top and left groups?

3 years ago

I had wanted to implement an ability to reorder them dynamically with this mod, but there were some things preventing that.

See this request from when I first wrote the mod
https://forums.factorio.com/viewtopic.php?f=28&t=79583

I can explain some technical details in case anyone familiar with factorio modding has some good ideas to work around these constraints.

The hope was that if I could set an ordering property of the GUI elements then I would easily be able to achieve the desired behavior. For example group A could be the first elements, then group B, etc

This would be the easiest way to implement the reorder, but it would require WUBE to do some back end work to enable, and it may be a heavy lift and not be worth it.

They use this same order string logic when the game is loading up to sort out the crafting recipes and various other things, but I don't think they have anything that supports dynamically reordering in during runtime.

For example, recipes have an order string associated with them but it is read-only while the game is running, so it can't be updated by mods.
https://lua-api.factorio.com/latest/LuaRecipe.html#LuaRecipe.order

Similarly, the interface to get the parent of an element, i.e., at the top level if it is 'top' or 'left' is read-only, so you can't just overwrite button A's parent to be 'left'.
https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.parent
The GUI children are also read-only:
https://lua-api.factorio.com/latest/LuaGuiElement.html#LuaGuiElement.children

It may be possible to brute force 'clone' the elements and delete the original, but that could potentially mess a few things up.
The game tracks which mod creates the GUI and this would then make this mod the owner of all the cloned elements. An even more likely thing to cause issues is that mods that add GUIs may expect their GUI to be in the top GUI at all times and break the other mods functionality.

2 years ago

any news ?

2 years ago
(updated 2 years ago)

Hi there !
And what about locating the GUI elswhere ? Is everything restricted to the top left ?
It's sad how much the game isn't friendly to GUI customisation / placement...

Well, GUI Manager is already a big relief as it is, much clearer now, thanks much for that !

(Edit: There is also a crash sometimes, seems like some mod's GUI bypass the manager when they reload :
They're supposed to be hide,so when they come back on while still being unchecked in the manager, opening the manager again crash the game.
It's an error than can be avoided by always coming back at the very first page of the manager before closing it, so maybe it could be automatic ?

2 years ago

Any updates would be in that thread. If readers here who care comment on the forum request it may help.

Unfortunately, relocating the GUI elsewhere is extremely likely to cause new crashes, because the mods may use the GUI position in their code. If their GUI is not where they expect it to be, the most likely outcome is a crash will occur.

The problem of that crash is that the other mods have no knowledge of the GUI manager mod hiding their GUI, so because the mod author didn't anticipate other mods messing with the GUI, something in the code can cause a crash.

I don't know if I'll be free to address the issue you found anytime soon, but if anyone comes up with a fix I'll be happy to update.

2 years ago

Thanks for the reply !
Still, that's something that didn't happen often, and it even doesn't at all anymore (to me) since I learned the habit to come at first page each time ^^

Let's hope Factorio one day will ease the GUI modding ^^ And as I said, love the mod ! Don't see myself playing without !

New response