Expand inventory tiles clickable areas to cover the grid

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Zaflis
Filter Inserter
Filter Inserter
Posts: 414
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Expand inventory tiles clickable areas to cover the grid

Post by Zaflis »

inventoryGrid.png
inventoryGrid.png (4.06 KiB) Viewed 1110 times
Inventory has 2 pixels wide grid. It makes it easy to misclick the grid instead of item slot and then get confused and frustrated on why click didn't work, either when dropping or picking an item stack. Quickbar is already nice and compact with 0 padding, please let us have this for inventory too.

I tried to make a mod out of this but i don't see how that is possible. Ctrl+F6 gives this info about the slot:
slot_button.png
slot_button.png (501.45 KiB) Viewed 1110 times
Basically i have tried setting all padding's to 0, width/height, natural_width/height from 36 to 38 but nothing works. Code like this should practically change the slots style:

Code: Select all

local style = data.raw["gui-style"].default
style.slot_button.padding = 0

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

Re: Expand inventory tiles clickable areas to cover the grid

Post by Rseding91 »

You can already do this with styles. You're just some how not actually applying the code you've written?

Removing the padding from the style shows that it's removed in the in-game tooltip:
no-padding.PNG
no-padding.PNG (246.84 KiB) Viewed 1089 times
However the table the slots sit in still has spacing:
table-spacing.PNG
table-spacing.PNG (89.17 KiB) Viewed 1089 times
Removing that too removes all space between slots and makes the inventory look quite ugly:
no-padding-anywhere.PNG
no-padding-anywhere.PNG (137.79 KiB) Viewed 1089 times
But if that's what you want - you can just do that in a mod and it works.
If you want to get ahold of me I'm almost always on Discord.

Zaflis
Filter Inserter
Filter Inserter
Posts: 414
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Expand inventory tiles clickable areas to cover the grid

Post by Zaflis »

I would add 1 pixel transparent border to the slot graphics itself so it would look exactly the same, in theory. Grid would still be there just not act as "void zone".

And i was applying the code in data-final-fixes.lua like so:

Code: Select all

local style = data.raw["gui-style"].default
style.slot_button.padding = 0
style.slot_button.cell_padding = 0
style.slot_button.top_cell_padding = 0
style.slot_button.bottom_cell_padding = 0
style.slot_button.left_cell_padding = 0
style.slot_button.right_cell_padding = 0
This doesn't work, or i wonder... I got a feeling it stretched not the button graphics (nor its clickable area) but all actual items on top of them.

Edit: oh i see horizontal and vertical spacing.. i'll try those later today.

Zaflis
Filter Inserter
Filter Inserter
Posts: 414
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Expand inventory tiles clickable areas to cover the grid

Post by Zaflis »

So this works:

Code: Select all

local style = data.raw["gui-style"].default
--style.default.slot_button.padding = 0
style.slot_table.horizontal_spacing = 0
style.slot_table.vertical_spacing = 0
The padding wasn't necessary. Now just to add the visual grid back...

This for starters was not a smart idea: :oops:

Code: Select all

style.slot_table.width = 38
style.slot_table.height = 38
Edit: I made big progress and grid is recovered, though interactible to nearest inventory tile. Everything looks exactly as in vanilla game. I couldn't reuse the existing gui graphics with smaller scale so i had to draw it myself. Now that inventory is done i saw that altering the base button makes changes to all other gui elements that use slot_button as parent...

But expect a mod coming, soon i hope. Naming this CompactGrids. Unless of course Factorio developers decide to implement this in base game which would be most preferrable.

Zaflis
Filter Inserter
Filter Inserter
Posts: 414
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Expand inventory tiles clickable areas to cover the grid

Post by Zaflis »

So i'll do a situation report this once. I decided to use the new GUI graphics (slightly edited) while at it and i don't have complaints about the inventory part :D As you may see i still have to redo the recipe UI (because they share same layout and that's hardcoded!). But you can compare the new and old.
slots.png
slots.png (776.64 KiB) Viewed 1047 times
Mod: https://mods.factorio.com/mod/CompactGrids

Post Reply

Return to “Ideas and Suggestions”