Skip to content

removing Items at runtime using RemoveShopItem() will result in sales being displayed where they shouldn't #83

@Inoyuuuuu

Description

@Inoyuuuuu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions