Properly selecting items from the quickbar via mod

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
dewiniaid
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 07, 2017 8:50 pm
Contact:

Properly selecting items from the quickbar via mod

Post by dewiniaid »

I'm working on a mod to add a keybinding to quickly swap between related items (e.g. transport belt -> splitter -> underground belt, or transport belt -> fast transport belt -> express transport belt). It's my first foray into Factorio modding, but I have some (outdated) Lua knowledge and a solid software development background.

I've figured out how to change what's under the cursor (via LuaControl.cursor_stack.swap_item, for instance) and how to clear it, but I haven't found the appropriate functionality to properly select an item from the quickbar (in such a way that "Q" returns it to that slot of the quickbar and it shows with the hand over it).

Is this possible at all under the current modding API? If so, how might I accomplish it?

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Properly selecting items from the quickbar via mod

Post by Bilka »

I already responded on discord, but swap_stack works correctly with quickbar slots in 0.16.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Modding discussion”