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()
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.