Auto Resource Redux


Automatic resource distribution between machines - for RTS like/combat focused gameplay

Overhaul
21 days ago
1.1
298
Logistics Cheats

g How to remove margin

25 days ago

I tried to do it myself because it's probable an issue only for me. But failed miserably.

Having margins around the buttons lets the factory be seen thru those gaps. And that visual noise makes almost impossible for me to search for any given icon.... So I tried removing that margin (or padding). But no matter how much I tried, I couldn't find where it's defined :<
Second thing I tried was to make the buttons container wider. Failed as well 😭

Can you help me please? where are those dimensions defined?
I love your mod

25 days ago
(updated 25 days ago)

If you press Ctrl+F6 it'll enable GUI debug mode which will tell you information about GUIs when you hover your cursor over them. The spacing between the buttons comes from the parent table:

which can be changed to 0 with the following patch:

diff --git a/auto-resource-redux/src/GUIResourceList.lua b/auto-resource-redux/src/GUIResourceList.lua
index 03f820f..734f909 100644
--- a/auto-resource-redux/src/GUIResourceList.lua
+++ b/auto-resource-redux/src/GUIResourceList.lua
@@ -43,6 +43,8 @@ function GUIResourceList.get_or_create_button(player, storage_key)
     name = group_name,
     index = find_gui_index_for(table_flow, storage_keys_group_order, group_name)
   })
+  table_elem.style.horizontal_spacing = 0
+  table_elem.style.vertical_spacing = 0

   local button = table_elem[storage_key] or GUICommon.create_item_button(
     table_elem,

(technically this isn't the best way to do it because it's assigning the style to the element every time it is updated)

Looks a lot more readable actually, I think I should add this change to the next version, but not sure if I need to take care of the 1px gaps that remain.

The remaining gaps probably come from the button style, but it doesn't seem obvious how to change those. It probably has something to do with the sprites that the buttons use, which would require defining a new button style prototype that points at a different part in the sprite sheet (look at how slot_button is defined in data.raw).

New response