[MOD 0.16] Inventory Quickbar

Topics and discussion about specific mods
GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

[MOD 0.16] Inventory Quickbar

Post by GodsFather »

Inventory Quickbar

Type: Mod
Name: Inventory Quickbar
Description: Adds a new configureable Quickbar container to access items without opening the inventory
License: GNU GPLv3
Version: 0.16.9
Release: 2018-03-03
Initial release: 2018-02-20
Tested-With-Factorio-Version: 0.16.25
Category: Helper mods
Mod-Portal: https://mods.factorio.com/mod/quickbar


Notes

This is my first mod, and already got a first reported bug on the mod portal (it's fixed)
I would appreciate feedback and of course if there any problems / bug just report it.
I'll try to fix them asap.

The reason for this mod development is quite simple. I could find something like it.
I've got a big screen (see last screenshot) and wanted the space more efficent.

My preferred soulution would be an extended quickbar like the default one - with a lot more slots per line.
With 21:9 ar there is plenty of space at the sides.
But as that isn't possible, I thought about attaching a Quickbar to the left side of the screen.
I'm using a lot of mods and that results in a lot of different items.
My inventory is usally a mess - so I found this way to bring a bit "order" into my chaos.
Description
Screenshots
Upcoming Features, Known and Fixed Issues
Changelog
Last edited by GodsFather on Sat Mar 03, 2018 3:21 pm, edited 17 times in total.

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

Re: [MOD 0.16] Inventory Quickbar

Post by eradicator »

I've attempted to make something similar quite some time ago so i do know some potential quirks. Tried your mod and this is what i found:
  • Ignores items in the quickbar.
  • Deletes content of blueprints on various occasions (putting in, pulling out, etc), probably deconstruction planners too.
  • Deletes content of power armor on various occasions
  • Replenishes ammo when merging stacks
  • Stack size picked up when multiple stacks exist is unpredictable and not always the maximum stack size. I had 235 ammo in inventory (100/100/35, inventory sorting off) and sometimes it merges them all but only picks up 100, sometimes it picks up 35.
  • Probable doesn't handle item-with-inventory/item-with-tags correctly though i don't have any to test with :P
Yea. So. Eeer...have fun fixing all of those :P (personally i think blueprint handling can't be done nicely becaues sprite-buttons don't allow to set compound icons).

Also had a quick look at your code and there's no way your use of "locals.first_tick" will not instantly desync in multiplayer.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by GodsFather »

Thanks for your feedback.
  • Items in quickbar are supposed to be ignored as said in the description. At least this behavoir is on purpose
  • I saw the blueprint bug a few minutes ago. I don't think that will be possible, can only be prevented
  • Powerarmor (or items with inventory etc) I haven't tried, will be same problem as with the blueprint I think
  • Ammo I will have a deeper look at. That should be fixable
  • The stack choosen is managed with LuaInventory.find_item_stack() (API Desc.: Gets the first LuaItemStack in the inventory that matches the given item name. - so it should be the first stack of that item)
  • And you are 100% right: Item-with-inventory isn't handled at all. Will be again same problem like blueprints / powerarmor / ... I guess
In general I'm not using self set sprite buttons, only choose-elem-buttons. And I'm sure they not supporting saved blueprints or similar "iventory items"
That part would need full rework I think.

The "locals.first_tick" is only important for singleplayer games and should have no effect on multiplayer games at all.
And that only to implement a workaround for a bug I reported here: viewtopic.php?f=30&t=58012 in conjunction with a missing event for singleplayer games that is triggered every time a game is loaded.
In multiplayer that workaround is handled with "event.on_player_joined_game"
And thats to awesome fast feedback in my bugreport: can all be kicked out with next Factorio version :-)

Again thanks for you feedback and look in the code.
Last edited by GodsFather on Wed Feb 21, 2018 8:43 am, edited 1 time in total.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Changelog Version 0.16.3

Post by GodsFather »

Version: 0.16.3
Date: 2018-02-21

Changes:
- Added option to use items from quickbar (default: off)

Fixed:
- Deletes content of blueprints on various occasions
- Deletes content of power armor on various occasions
- Replenishes ammo when merging stacks
- Stack size picked up when multiple stacks exist is unpredictable and not always the maximum stack size

Known issues:
- Quickbar item order get messed up when changing number of columns
- Only "generic items" can be defined (no filled out blueprints, items with inventory, ect.), selection takes random item out of inventory
Last edited by GodsFather on Wed Feb 21, 2018 8:43 am, edited 1 time in total.

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

Re: [MOD 0.16] Inventory Quickbar

Post by eradicator »

GodsFather wrote:
  • Items in quickbar are supposed to be ignored as said in the description. At least this behavoir is on purpose
Well, it leads to the irritating behavior that sometimes you can pickup an item from the quickbar (->inventory) but when you clear the cursor the item is put into an empty quickbar slot and thus can't be picked up via quickbar any more. This would mostly happen in early game when you have less than one stack of the item and/or no filtered toolbar slots. Ah. but i see you already included an option :P.
Detecting blueprints should actually be not-too-difficult if you absue the bp string. Power armors or other special items (i.e. anything that is not strictly "item" prototype) are would all require very special handling.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by GodsFather »

Detecting a blueprint is possible within the inventory, but not when dropping the blueprint to the quickbar.
The used choose-elem-button only fires "event.on_gui_elem_changed" with includes the "element" => the button itself.
The button only saves the value in "elem_value" as string (= item-name)
As I already expected: saves of blueprints would need a full rework of the way buttons are generated / used / ...
I'm still thinking about a proper workaround

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

Re: [MOD 0.16] Inventory Quickbar

Post by eradicator »

GodsFather wrote:The used choose-elem-button only fires "event.on_gui_elem_changed" with includes the "element" => the button itself.
And the player_index which can be used for lots of things. Like reading the cursor_stack used to click the button. How you store and use that information is a different story ofc.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Changelog Version 0.16.4

Post by GodsFather »

Version: 0.16.4
Date: 2018-02-21

Changes:
- Basic blueprint handling; blueprints can be assingned / selected; first preview icon on blue background is used

Fixed:
- Removed duplicate code in event.on_gui_click

Known issues:
- Quickbar item order get messed up when changing number of columns
- "Generic items" (and blueprints) can be set; filled out deconstruction planners, items with inventory, ect. selection takes random item out of inventory
- Filled blueprints showing tooltip of first blueprint icon
- Changes of linked blueprint setups will invalidate the Quickbar assignment of that blueprint (has to be reassigned manually atm)
Last edited by GodsFather on Fri Feb 23, 2018 3:09 pm, edited 1 time in total.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Changelog Version 0.16.5

Post by GodsFather »

Version: 0.16.5
Date: 2018-02-23

Fixed:
- Quickbar item order get messed up when changing number of columns

Known issues:
- "Generic items" (and blueprints) can be set; filled out deconstruction planners, items with inventory, ect. selection takes random item out of inventory
- Filled blueprints showing tooltip of first blueprint icon
- Changes of linked blueprint setups will invalidate the Quickbar assignment of that blueprint (has to be reassigned manually atm)

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by Ironhair »

I love the idea of this mod.. especially as the regular toolbar upgrades end up taking over 30% of my screen in the bottom bar.

However, there is a problem with this mod's fixed items disappearing between 2 saves.
This has happened to me multiple times, when I adjust other mod files.

Any idea?
I can share my mod file + save files, but that's going to be a 200mb download.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by GodsFather »

I tried to reproduce it, but I wasn't able to.
So it would be great if you can share you mod's and the save to figure out where the problem is.

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by Ironhair »

It happened again.
All I did was add a new mod and restart the game.
Lost all my additions to the quickbar.

When I removed the new mod and restarted, the quickbar binds came back.

attaching zip file.
https://ufile.io/vpi87
It has my mod folder zipped inside it
+ the new mod (any will do, but textplates_0.3.3.zip is what triggered it most recently)
+ the save file.

This is what it should look like (the inventory bar settings)
https://imgur.com/yBhn0AD
This is what it looks like when I add a new mod
https://imgur.com/mD0odsJ


If you are on discord, feel free to reach me.. I reply much quicker there.
IronHair#2367

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

Re: [MOD 0.16] Inventory Quickbar

Post by eradicator »

Hah. Looked at the code and i can't even find where you store the button layout to global :x. So much for trying to help.
Sounds like some broken index resetting in on_config_changed. But no clue why it would revert back then after(?! @Ironhair can you confirm?) saving with the broken layout.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Changelog Version 0.16.6

Post by GodsFather »

Version: 0.16.6
Date: 2018-02-25

Fixed:
- Bugfix for Quickbar item reordering when changing number of columns (rep.by.: Ironhair)

Known issues:
- "Generic items" (and blueprints) can be set; filled out deconstruction planners, items with inventory, ect. selection takes random item out of inventory
- Filled blueprints showing tooltip of first blueprint icon
- Changes of linked blueprint setups will invalidate the Quickbar assignment of that blueprint (has to be reassigned manually atm)


@Ironhair: thanks for the report and providing all the infos! :-)
Last edited by GodsFather on Sun Feb 25, 2018 5:53 pm, edited 1 time in total.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by GodsFather »

eradicator wrote:Hah. Looked at the code and i can't even find where you store the button layout to global :x. So much for trying to help.
Sounds like some broken index resetting in on_config_changed. But no clue why it would revert back then after(?! @Ironhair can you confirm?) saving with the broken layout.
It was at least connected to the "on_config_changed".
A bug in conditions / processing config values within the item reordering after changing number of columns.
Resulted in triggering the item reorder fix with a wrong number of old columns - even without chaning the number of columns.

As the button layout / GUI is persistent and stored within the savegame, there is no need for a seperate storage at the moment.

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: Changelog Version 0.16.6

Post by Ironhair »

eradicator wrote:Hah. Looked at the code and i can't even find where you store the button layout to global :x. So much for trying to help.
Sounds like some broken index resetting in on_config_changed. But no clue why it would revert back then after(?! @Ironhair can you confirm?) saving with the broken layout.
I didn't try to save the game and then remove the mod...
GodsFather wrote:Version: 0.16.6
Date: 2018-02-25

Fixed:
- Bugfix for Quickbar item reordering when changing number of columns (rep.by.: Ironhair)

Known issues:
- "Generic items" (and blueprints) can be set; filled out deconstruction planners, items with inventory, ect. selection takes random item out of inventory
- Filled blueprints showing tooltip of first blueprint icon
- Changes of linked blueprint setups will invalidate the Quickbar assignment of that blueprint (has to be reassigned manually atm)

@Ironhair: thanks for the report and providing all the infos! :-)
I should be thanking you, A LOT.
This is what I have been wanting for a really long time :D
- Bugfix for Quickbar item reordering when changing number of columns (rep.by.: Ironhair)
A bug in conditions / processing config values within the item reordering after changing number of columns.
Resulted in triggering the item reorder fix with a wrong number of old columns - even without chaning the number of columns.
I didn't understand btw.. was the bug was because of the mod list being changed / new mod being added or because the columns weren't default?

Is there any chance to have the quickbar hide using a hotkey (which can be changed using mod settings)?

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

Re: Changelog Version 0.16.6

Post by eradicator »

Ironhair wrote:Is there any chance to have the quickbar hide using a hotkey (which can be changed using mod settings)?
.style.visible = false

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Re: Changelog Version 0.16.6

Post by GodsFather »

Ironhair wrote:... I didn't understand btw.. was the bug was because of the mod list being changed / new mod being added or because the columns weren't default? ...
Because the number of columns weren't default and mod list changed (what triggered the on_config_changed event) - and under this circumstances the column "reordering" read out the column numbers in wrong place and "thought" reordering was needed.
Ironhair wrote:Is there any chance to have the quickbar hide using a hotkey (which can be changed using mod settings)?
Done, new version uploaded.

GodsFather
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue Apr 26, 2016 2:46 pm
Contact:

Changelog Version 0.16.7

Post by GodsFather »

Version: 0.16.7
Date: 2018-02-26

Changes:
- Added keyboard binding for toggle display state (hide / show), default: CTRL + SHIFT + B

Known issues:
- "Generic items" (and blueprints) can be set; filled out deconstruction planners, items with inventory, ect. selection takes random item out of inventory
- Filled blueprints showing tooltip of first blueprint icon
- Changes of linked blueprint setups will invalidate the Quickbar assignment of that blueprint (has to be reassigned manually atm)

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Quickbar

Post by Ironhair »

This is so awesome!

Thank you, GodsFather ....

... and eradicator ;)

Post Reply

Return to “Mods”