Page 1 of 1

Load an item into player's cursor_stack ?

Posted: Sun Jul 31, 2016 9:05 am
by binbinhfr
Hi,

I know how to load an item in to player's cursor :

Code: Select all

		player.cursor_stack.set_stack({name = "test", count = 1})
		player.remove_item({name = "test", count = 1})
And I can put it back the same way.

But it does not put it back at the same place, as the game does.
When you manually pick up an item in your bag, the game draws a little black hand in place of the picked item.
And when you clear the cursor, the item comes back at this memorised location.

Is there a way to do this with the API ?

Re: Load an item into player's cursor_stack ?

Posted: Sun Jul 31, 2016 9:42 am
by Choumiko

Re: Load an item into player's cursor_stack ?

Posted: Sun Jul 31, 2016 9:51 am
by binbinhfr
Choumiko wrote:This: http://lua-api.factorio.com/latest/LuaP ... ean_cursor ? added in 0.13.10
That is what I use for the moment, but it does not do the trick.

When you do

Code: Select all

      player.cursor_stack.set_stack({name = "test", count = 1})
      player.remove_item({name = "test", count = 1})
If you do not remove the item from inventory, then when calling clean_cursor(), anotehr item is added in inventory...
And if you do remove, when calling clean_cursor(), the item is put back in inventory, but anywhere.

Not the same way te game does with this "black hand" memorised location.