As title says, allow LuaPlayer::cursor_stack_temporary for "selection-tool".
Reason: it behaves like a blueprint / deconstruction planner / upgrade planner in how it selects things and that it is not expected to return to the inventory if it was given to the player via a commond or gui interaction.
Use case: I have players use a command which provides them with a selection tool to select an area, using "on_player_selected_area" I can listen for this action to perform my logic then clear the cursor. But if the player presses Q to clear the cursor then it returns to the inventory, which causes issues if the player's inventory is full. My current solution is to use "character_inventory_slots_bonus" but this has many edge cases such as entering and exiting remote view, the player dieing, needing to set hand location in the inventory, etc. These would not exist if I could set the stack as temporary like is possible with a deconstruction planner.
Allow temporary cursor stack for selection tool
- Cooldude2606
- Fast Inserter
- Posts: 110
- Joined: Sat Sep 16, 2017 9:04 pm
- Contact:
-
- Burner Inserter
- Posts: 8
- Joined: Thu Apr 17, 2025 6:44 pm
- Contact:
Re: Allow temporary cursor stack for selection tool
AFAIK you can achieve what you want by setting "only-in-cursor" flag in your "selection-tool" item prototype flags
- Cooldude2606
- Fast Inserter
- Posts: 110
- Joined: Sat Sep 16, 2017 9:04 pm
- Contact:
Re: Allow temporary cursor stack for selection tool
That solution would work for some selection tools, but some others are created with extra command arguments (tacked with LuaItemCommon.item_number) and it can be useful to keep these in your inventory to avoid needing to re-use the command. This is the same behaviour as a decon planner where pressing Q will delete it, but you can manually place it into your inventory.