Under src/game_object.lua, the function SMODS.Consumable.inject is responsible for registering a new consumable. If the newly registered consumable is hidden like Soul or Black Hole, a reference to the consumable gets added to the list SMODS.Consumable.legendaries, which if I'm understanding the code right appears to be a single table shared across all consumables. However, SMODS.Consumable.delete does not then remove the consumable from the legendaries table. This can leave a dangling reference to a removed legendary consumable, which means the game will still roll for the chance to produce that legendary consumable when opening the corresponding pack. If the roll succeeds, the game will try to generate the consumable, fail to find it from G.P_CENTERS, and crash.
To fix this crash, SMODS.Consumable.delete needs to remove the deleted consumable from self.legendaries.
Under src/game_object.lua, the function SMODS.Consumable.inject is responsible for registering a new consumable. If the newly registered consumable is hidden like Soul or Black Hole, a reference to the consumable gets added to the list SMODS.Consumable.legendaries, which if I'm understanding the code right appears to be a single table shared across all consumables. However, SMODS.Consumable.delete does not then remove the consumable from the legendaries table. This can leave a dangling reference to a removed legendary consumable, which means the game will still roll for the chance to produce that legendary consumable when opening the corresponding pack. If the roll succeeds, the game will try to generate the consumable, fail to find it from G.P_CENTERS, and crash.
To fix this crash, SMODS.Consumable.delete needs to remove the deleted consumable from self.legendaries.