Skip to content

Crash when opening booster after adding and removing a legendary consumable #1398

@paulkent-coder

Description

@paulkent-coder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions