Page 1 of 1

inventory window height - how to modify it?

Posted: Sat Nov 18, 2017 7:19 pm
by Dixi
Where and how to change maximum allowed vertical size of inventory window?
Console command? Config string?

More detailed explanation, why I want it:
When I play vanilla mode inventory window have reasonable size.
As soon as I try to play with mods (like Bob's or Angel's) inventory window grows from top of the screen to its bottom and obscure all surrounding. If I play a little more, a vertical scrollbar appears in inventory.
Since scrolling for this window works well, I think there should be a way to limit it vertical size to something more comfortable.

I was searching around forums but did not found answer, and did not managed to find correct parameter in Factorio API. I suppose it's near game.player.inventory, but did not found exact variable name.

Re: inventory window height - how to modify it?

Posted: Mon Nov 20, 2017 7:01 pm
by Dixi
No one knows? Or it's technically difficult?

I thought all interface windows have some properties, like current height. For inventory it's probably recalculated every time when something adds a new recipe to available list. But there should be maximum allowed height, that is probably calculated at the moment when whole interface is created or resized. As soon as current inventory height becomes greater then max.allowed a scroll bar appears. So parameter I'm looking for probably should be called like "maximum allowed visible height of inventory window".

It might be not visible from LUA code, but that is less likely, because, as I know, almost all Factorio code is written on LUA, with some exceptions on C++. Correct?

Re: inventory window height - how to modify it?

Posted: Mon Nov 20, 2017 7:23 pm
by eradicator
Dixi wrote:It might be not visible from LUA code, but that is less likely, because, as I know, almost all Factorio code is written on LUA, with some exceptions on C++. Correct?
Alsmost all of factorio is written in C++, with some exceptions written in LUA.
The base gui components are not accessible for mods or console commands.

Re: inventory window height - how to modify it?

Posted: Mon Nov 20, 2017 7:54 pm
by Koub
... but, as the devs are working on a gui rewrite, I hope this will change with the new gui :)

Re: inventory window height - how to modify it?

Posted: Mon Nov 20, 2017 8:23 pm
by Dixi
Looking in Factorio API.

There is a class LuaStyle, that has property
maximal_height :: int [RW]

There is a reference there to LuaGuiElement, and sample
game.player.gui.top.add{type="label", name="greeting", caption="Hi"}
game.player.gui.top.greeting.caption = "Hello there!"
game.player.gui.top["greeting"].caption = "Actually, nevermind, I don't like your face"
I suppose if I find correct name for player inventory window and write something like
game.player.gui.<main_Inventory?>.style.maximal_height = 300
that might work. Will it?

The problem is I dunno how graphical interface designed. When I open an inventory in the game, is it one big window with 3 child windows "Inventory", "Logistic", "Crafting" attached to it? Or it's 3 different clipped windows? And graphical tab icons in Crafting, do they linked to corresponding LuaGuiElement, and just setting it visible?
Maybe someone saw a scheme in API guide? I did not found it yet.

Re: inventory window height - how to modify it?

Posted: Mon Nov 20, 2017 11:23 pm
by Rseding91
Dixi wrote:Looking in Factorio API.

There is a class LuaStyle, that has property
maximal_height :: int [RW]

There is a reference there to LuaGuiElement, and sample
game.player.gui.top.add{type="label", name="greeting", caption="Hi"}
game.player.gui.top.greeting.caption = "Hello there!"
game.player.gui.top["greeting"].caption = "Actually, nevermind, I don't like your face"
I suppose if I find correct name for player inventory window and write something like
game.player.gui.<main_Inventory?>.style.maximal_height = 300
that might work. Will it?

The problem is I dunno how graphical interface designed. When I open an inventory in the game, is it one big window with 3 child windows "Inventory", "Logistic", "Crafting" attached to it? Or it's 3 different clipped windows? And graphical tab icons in Crafting, do they linked to corresponding LuaGuiElement, and just setting it visible?
Maybe someone saw a scheme in API guide? I did not found it yet.
The core game GUIs aren't done through the mod-accessible GUI system and as such you don't have access to change them through mods. The core game GUIs have a ton of non-game-state information that would trigger desyncs if any mod tried to us that information among other reasons.

Re: inventory window height - how to modify it?

Posted: Tue Nov 21, 2017 1:21 am
by eradicator
@Koub
@Rseding91

I thought about it and in a kinda-sorta-roundabouter fashion this is already possible. But due to current layout ofc horribly breaks other stuff:
Even the base GUIs use data.raw['gui-style'].default for their styles, so can enforce a maximal_height on those styles in the data stage. On a quick look it didn't seem like the inventory has a unique style though so changing it breaks other stuff.

Code: Select all

for k,v in next, gui do
  if v.type == 'frame_style' then --didn't bother to test all styles seperately
    print(k)
    v.maximal_height = 300
    end
  end