removing Items at runtime using RemoveShopItem() will result in sales being displayed where they shouldn't
My mod's configs allow players to remove items from the store and I want this setting to be synced across all clients. For this to work, the removal of the Item must happen during the game. If I use Items.RemoveShopItem() the item successfully doesn't show up in the store anymore, but the Terminal's sales are shifted by one after the removed item. I think this has something to do with the itemSalesPercentages list not using the right indexes, although I'm not sure. Patching the method and editing this list did not work for me, the item sales were still off (and I managed to break a lot of other things along the way).
My attempt to fix this was patching the SetItemSales() method, searching for removed items in the buyable items list, switching them with the items on the end of the list and switching their buyableItemIndexes of their Terminal nodes. This kind of works, but I don't trust it... I still don't really get how the whole Terminal works and wanted to ask if you have an idea on how to fix the sales issue when removing items at runtime.
Would you be interested in fixing this? If you open a PR, I can review it and merge it.
I appreciate the offer and would fix it, but I'm not sure if I can (I tried to in the past but failed). I had a hard time understanding some things related to the terminal, that's why I was hoping you (or any other developer of LethalLib) had an idea on how to get rid of this bug. I also kind of lost my motivation for lethal company modding atm.. if I get it back and decide that I want to work on this, I'll let you know. c:
Okay! And well, we are probably going to write a new content API from the ground up and for that we'll try fixing this if we end up implementing this feature, and then either pointing LethalLib to use that or just implementing the fix also for LethalLib before we do that.