Swapping inventory stack with cursor stack loses reserved inventory slot

Place to get help with not working mods / modding interface.
sparr
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Swapping inventory stack with cursor stack loses reserved inventory slot

Post by sparr »

I have a blueprint in my inventory. I click it, to put it in my cursor. The slot in my inventory now has a hand icon, reserved for the blueprint to return to. I click in the world to place the blueprint. At this point, my mod event triggers and it does some manipulation of the cursor item stack. The blueprint gets swapped back to the main inventory or to a temporary script inventory, some stuff happens, then it gets swapped back to the cursor stack.

At this point, the reserved slot in the main inventory is gone.

How can I preserve that reserved slot through this process?
robot256
Smart Inserter
Smart Inserter
Posts: 1201
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Swapping inventory stack with cursor stack loses reserved inventory slot

Post by robot256 »

I don't think you can avoid the original location of the hand being lost when you modify the cursor stack. But you can reserve another empty slot by script with https://lua-api.factorio.com/latest/cla ... d_location
sparr
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Swapping inventory stack with cursor stack loses reserved inventory slot

Post by sparr »

It looks like the original location is still empty/available later in the same event, so I was able to save and restore hand_location around my cursor manipulations. thanks!
Post Reply

Return to “Modding help”