Jump to content

An action item can be invisible due to a missing check in regard of Future/Mod aspect


Rickzzs
  • Pending
function Inventory:EquipActionItem(item)
    if item == nil then
        item = self:GetActiveItem()
    elseif item ~= nil
        and (item.components.inventoryitem == nil or
            item.components.inventoryitem:GetGrandOwner() ~= self.inst) then
        return
    end
    if item ~= nil and
        item.components.equippable ~= nil and
        item.components.equippable.equipslot == EQUIPSLOTS.HANDS then
        if not item.components.equippable:IsEquipped() then
            if item.components.stackable ~= nil and item.components.stackable.stacksize > 1 and not item.components.equippable.equipstack then
                local stack = item.components.stackable:Get(item.components.stackable.stacksize - 1)
                self:GiveItem(stack)
            end
            self:Equip(item)
        end
        if self:GetActiveItem() == item then
            self:SetActiveItem()
        end
    end
end

For example, this function does not check the result of Equip, thus the active item may not be equipped correctly, making it lost forever in limbo state.


Steps to Reproduce
a=c_give('spear')
a.components.equippable.preventunequipping=true
b=c_give('yellowstaff')
ThePlayer.components.inventory:Equip(a)

Use mouse to cast star staff held at hand.




User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...