Allow LuaPlayer.cursor_stack_temporary write for all selection tools
Posted: Wed Feb 01, 2023 1:22 am
Currently writing to LuaPlayer.cursor_stack_temporary is ignored for everything that is not a blueprint, blueprint-book, deconstruction-planner or upgrade-planner.
I request to make this check one level higher, make it work for all selection tools.
Most modded selection tools, like the vanilla ones, are free to create using the shortcut bar. If they are created this way this value will already be set to true even though it is not one of the above types:

So would be nice to have this same behaviour when the item is created elsewhere.
Usecase:
The following code
can turn into
The selection_tool item enters the inventory in the first case, but not in the second. It never has to be in the inventory.
I request to make this check one level higher, make it work for all selection tools.
Most modded selection tools, like the vanilla ones, are free to create using the shortcut bar. If they are created this way this value will already be set to true even though it is not one of the above types:

So would be nice to have this same behaviour when the item is created elsewhere.
Usecase:
The following code
Code: Select all
player.clear_cursor()
local inventory = player.get_main_inventory()
local item_stack = inventory.find_item_stack(selection_tool)
if item_stack then
item_stack.swap_stack(player.cursor_stack)
else
player.cursor_stack.set_stack({name=selection_tool})
end
Code: Select all
player.clear_cursor()
player.cursor_stack.set_stack({name=selection_tool})
player.cursor_stack_temporary=true