Jump to content

Move Item in backpack seems working in a wrong way


Littlefat1213
  • DLC VERSION - IMPORTANT!: Vanilla - NO DLC, Reign of Giants, Shipwrecked, Hamlet Pending

when i move item in backpack via shift + leftclick, it just combine the stacks in backpack like this gif.It should be working as transfering the items to inventory i think.

the dest in Invslot:TradeItem got the correct result(inventory) ,but inventory:GiveItem seems will check the retained items in inv and overflow then combine the stack first when the slot_number is not specified.

function InvSlot:TradeItem(stack_mod)
	...
  if not dest:GiveItem(item, nil, nil, nil, true) then --dest is inventory at this time
    container:GiveItem(item, slot_number, nil, true)
  end
  return
end

function Inventory:GiveItem( inst, slot, screen_src_pos, skipsound,dontDropOnFail )
  ...
     if slot then
        local olditem = self:GetItemInSlot(slot)
        can_use_suggested_slot = slot ~= nil and slot <= self.maxslots and ( olditem == nil or (olditem and olditem.components.stackable and olditem.prefab == inst.prefab)) and self:CanTakeItemInSlot(inst,slot)
    end

    local container = self.itemslots
    if not can_use_suggested_slot then --can_use_suggested_slot == false at this time, if no same prefab in inventory
		slot,container = self:GetNextAvailableSlot(inst) -- container is the backpack's and slot_num belongs to backpack's container
    end
  ...
end

9rFFs33QS2.gif


Steps to Reproduce

leftclick with holding shift to items in backpack




User Feedback




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...