JamesWilko / GoonMod

A gameplay mod suite for Payday 2.
http://jameswilko.com/GoonMod/
MIT License
60 stars 52 forks source link

Not able to equip saw skin on the secondary saw #135

Closed revnant closed 7 years ago

revnant commented 8 years ago

In Update 103, the One Percenter saw skin was introduced and only worked for the primary saw. In Update 104, Overkill updated the underlying code so that same saw skin can be applied to both primary and secondary saws.. However, I had to disable Goonmod (well turn off the Force Enable) in order to apply the saw skin on the secondary saw.

I think the issue is here in Goonmod's lua\BlackMarketManager.lua:

    Hooks:RegisterHook("BlackMarketManagerModifyGetCosmeticsInstancesByWeaponId")
    function BlackMarketManager:get_cosmetics_instances_by_weapon_id(weapon_id)
        local cosmetic_tweak = tweak_data.blackmarket.weapon_skins
        local items = {}
        for instance_id, data in pairs(self._global.inventory_tradable) do
            if data.category == "weapon_skins" and cosmetic_tweak[data.entry] and cosmetic_tweak[data.entry].weapon_id == weapon_id then
                table.insert(items, instance_id)
            end
        end
        Hooks:Call("BlackMarketManagerModifyGetCosmeticsInstancesByWeaponId", self, weapon_id, items)
        return items
    end

In the latest U104 code, it uses weapon_ids in addition to weapon_id for that if clause / statement above:

    if data.category == "weapon_skins" and cosmetic_tweak[data.entry] then
        if cosmetic_tweak[data.entry].weapon_ids then
            if table.contains(cosmetic_tweak[data.entry].weapon_ids, weapon_id) then
                table.insert(items, instance_id)
            end
        elseif cosmetic_tweak[data.entry].weapon_id == weapon_id then
            table.insert(items, instance_id)
        end
    end

I'm not sure what the correct proper fix is, but if I replace the if clause/statement with what I see in the U104 code, I can apply the saw skin to the secondary saw properly.

JamesWilko commented 7 years ago

Fixed, will be live in next update.