Page 1 of 1

[Rseding91] [0.17.17] [Modded] Calling LuaInventory::sort_and_merge() on cargo wagon with locked slots spills inventory

Posted: Sat Mar 23, 2019 2:16 pm
by TheBloke
Versions tested: 0.17.17 and 0.16.51
Platform: macOS 10.14.1 Mojave

Bug: Calling LuaInventory's sort_and_merge() on a cargo wagon whose inventory slots have been locked (red X) will cause the contents of those locked slots to spill to the ground and the icons on the cargo wagon to desync with the contents.

I first discovered this when using the mod Picker Inventory Tools by Nexela in 0.17.17, but was then able to re-create it in a non-modded game using Console commands. The bug also exists in 0.16.51 so it's not related to the 0.17 upgrade.

Steps to reproduce:
1. Put some random items in a cargo wagon
2. Lock some or all of the cargo wagon slots. Screenshot.
3. Execute the following console command:

Code: Select all

/c local inventory = game.player.opened.get_inventory(defines.inventory.cargo_wagon) ;  inventory.sort_and_merge() 
4. Any items in locked slots will spill to the ground (like when the player removes their power armour), and the cargo wagon inventory now shows as empty. However the icons on the cargo wagon are not updated, they still show what was in the wagon before it spilled. Screenshot.
5. The external wagon icons remain out of sync from this point - adding new items does not update them to reflect the real contents.

It's step two - locking filled slots - that is the trigger. sort_and_merge() works fine on a cargo wagon with no locked slots, and on empty locked slots.

Logfile from 0.17.17 attached.

Re: [0.17.17] [Modded] Calling LuaInventory::sort_and_merge() on cargo wagon with locked slots spills inventory

Posted: Wed May 15, 2019 6:14 am
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17.