Skip to content
  • Andrew Minton's avatar
    Fix some overlapping set bugs · 90e3b6c1
    Andrew Minton authored
    This fixes the Kinetic/Thermal/Charged set.
    
    Previously, if you equipped all three mindstars, then removed Kinetic Focus, the
    other two would lose ALL their set bonuses - including the Thermal/Charged set
    bonus, even though both are still equipped. If you re-equipped the Kinetic
    Focus, you would get the Kinetic/Thermal and Kinetic/Charged set bonuses, but
    not the Thermal/Charged one.
    In the general case, removing one item from any set would remove all set bonuses
    from all items in that set. This worked fine for non-overlapping sets, but does
    not work for overlapping ones: if X+Y, Y+Z, and X+Z are all sets, then removing
    X would take away the set bonuses for Y+Z, which it obviously should not.
    
    This commit changes set behaviour so that only set bonuses from the sets that
    were *actually broken* are removed. If you remove X, the bonuses for X+Y and X+Z
    are still removed, but the bonus for Y+Z remains. This fixes the
    Kinetic/Thermal/Charged Focus set.
    
    Object:specialSetAdd() now takes the set_id as a third parameter. This is
    only needed for overlapping sets and can safely be omitted for sets that do not
    overlap. Therefore, existing addons that use specialSetAdd() will not break.
    
    There are still other problems with mindstar ego sets that need to be addressed
    separately.
    
    Additionally, if you had e.g. two Mighty Girdles, one worn and one in your pack, it was
    possible that Actor:findInAllInventories() would find the one in your pack
    first, meaning that the set would not be completed. This is mainly relevant for
    mitotic mindstars, but could happen with any set in the game.
    
    The set code now only looks in worn inventories if no inven_id is specified,
    preventing this bug from happening. This also allows sets specifying non-worn
    inven_ids to work.
    90e3b6c1