[Solved] How to make a GUI button to give a selection tool ?
Posted: Thu Jul 16, 2020 1:42 pm
Hi,
I would like to make a GUI button that gives a custom "selection-tool" item when clicked. Exactly like a shortcut button, I just want to place it somewhere else with a specific caption.
This is my best attempt so far:
It works. But when the player cleans his cursor, the item is placed in his inventory. I tried to add the following line to fix this, but it didn't change anything:
Any suggestion to make it work ?
Thanks in advance.
I would like to make a GUI button that gives a custom "selection-tool" item when clicked. Exactly like a shortcut button, I just want to place it somewhere else with a specific caption.
This is my best attempt so far:
Code: Select all
-- player: https://lua-api.factorio.com/latest/LuaPlayer.html
player.clean_cursor()
player.cursor_stack.set_stack{
name = "my-selection-tool",
}
Code: Select all
player.hand_location = nil
Thanks in advance.