[Genhis] [1.1.70] LuaItemStack.swap_stack does not keep the temporary nature of items
Posted: Wed Nov 16, 2022 6:18 pm
As discussed on discord with Klonan:
https://discord.com/channels/1396775903 ... 1213481020
* Get a deconstruction planner in hand (alt+D). Dismiss it (Q). It disappears and does not go to the inventory, as expected.
* Get a deconstruction planner in hand again.
* Swap character and swap cursor stack using this:
* You are now the controlling the other character, but you still have the deconstruction planner in hand.
* Dismiss it (Q). The empty planner goes to inventory instead of disappearing.
This is an issue for the Jetpack mod, where it can cause players to end up with lots of empty planners in their inventories.
https://discord.com/channels/1396775903 ... 1213481020
Reproduction:
* Get a save file with 2 characters (save file included)* Get a deconstruction planner in hand (alt+D). Dismiss it (Q). It disappears and does not go to the inventory, as expected.
* Get a deconstruction planner in hand again.
* Swap character and swap cursor stack using this:
Code: Select all
/c
local old_char = game.surfaces.nauvis.find_entities_filtered{name = "character", force = "player", limit = 1, position = {-5.5,0.5}, radius = 2}[1]
local new_char = game.surfaces.nauvis.find_entities_filtered{name = "character", force = "player", limit = 1, position = {7.5,0.5}, radius = 2}[1]
game.player.set_controller{type=defines.controllers.character, character=new_char}
new_char.cursor_stack.swap_stack(old_char.cursor_stack)
* Dismiss it (Q). The empty planner goes to inventory instead of disappearing.
This is an issue for the Jetpack mod, where it can cause players to end up with lots of empty planners in their inventories.