inventory window height - how to modify it?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Dixi
Fast Inserter
Fast Inserter
Posts: 141
Joined: Sat Nov 04, 2017 1:47 pm
Contact:

inventory window height - how to modify it?

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

User avatar
Dixi
Fast Inserter
Fast Inserter
Posts: 141
Joined: Sat Nov 04, 2017 1:47 pm
Contact:

Re: inventory window height - how to modify it?

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

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

Re: inventory window height - how to modify it?

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

Koub
Global Moderator
Global Moderator
Posts: 7175
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: inventory window height - how to modify it?

Post by Koub »

... but, as the devs are working on a gui rewrite, I hope this will change with the new gui :)
Koub - Please consider English is not my native language.

User avatar
Dixi
Fast Inserter
Fast Inserter
Posts: 141
Joined: Sat Nov 04, 2017 1:47 pm
Contact:

Re: inventory window height - how to modify it?

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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: inventory window height - how to modify it?

Post 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.
If you want to get ahold of me I'm almost always on Discord.

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

Re: inventory window height - how to modify it?

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

Post Reply

Return to “Modding help”