Jump to content

Lureplant cannot store more than 13 full stacks of items


Parusoid
  • Pending

Lureplant has internal inventory of 15 slots. If no items have been eaten it spawns leafy meat which also occupies one inventory slots leaving 14 free slots. It means that in theory it can store up to 14 full stack of items. Grass stacks to 40, so 560 grass in total could fit inside, but it does not. It collects only up to 520 / 521 grass.

During testing i made sure no other foreign objects are around and that eyeplants finished transferring the items into lureplant. Lureplant cannot store more 13 full stacks of any item, sometimes it only gets to store 1 item of the 14th stack and i think what can be the reason. 

snip from lureplant.lua

Spoiler

local function CollectItems(inst)
    if inst.components.minionspawner.minions ~= nil then
        for k, v in pairs(inst.components.minionspawner.minions) do
            if v.components.inventory ~= nil then                
                for k = 1, v.components.inventory.maxslots do
                    local item = v.components.inventory.itemslots[k]
                    if item ~= nil and not inst.components.inventory:IsFull() then  -- its this line and the  inventory:IsFull() check
                        local it = v.components.inventory:RemoveItem(item)
                        if it.components.perishable ~= nil then
                            local top = it.components.perishable:GetPercent()
                            local bottom = .2
                            if top > bottom then
                                it.components.perishable:SetPercent(bottom + math.random() * (top - bottom))
                            end
                        end
                        inst.components.inventory:GiveItem(it)
                    elseif item ~= nil then
                        local item = v.components.inventory:RemoveItem(item)
                        item:Remove()
                    end
                end
            end
        end
    end
end

 

snip from inventory.lua
 

Spoiler

function Inventory:IsFull()
    for k = 1, self.maxslots do
        if not self.itemslots[k] then
            return false
        end
    end

    return true
end

 

it appears that lureplant stops collecting items when the slot is occupied, not when that slot is filled with maximum amount of stackable items. I think that is why I can't get more than 520 grass collected inside lureplant - once 1 grass goes into 14th slot, it stop collecting even tho it could possibly fit 39 more grass.

 

 


Steps to Reproduce

Plant lureplant

Make sure no foreing objects are around

Let eyeplants eat 14 or more stacks of any item (either stacked or unstacked does not matter)

Wait until all the items are transferef from eyeplants to lureplant

Kill lureplant, count the items




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