Get the inserter's effective stack size limitation

Post Reply
curiosity
Filter Inserter
Filter Inserter
Posts: 325
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Get the inserter's effective stack size limitation

Post by curiosity »

If you open an inserter, there's the option to override stack size and the related input field. Right now, there's LuaEntity.inserter_stack_size_override, which corresponds to that input field if and only if the override is enabled. Meanwhile the input field shows the actual stack size limit at all times, even when inactive. I want to be able to get that limit.

Right now, I have to do this:

Code: Select all

local function get_stack_size(inserter, prototype)
    local stack_size = inserter.inserter_stack_size_override
    if stack_size > 0 then
        return stack_size
    end
    if prototype.stack then
        return 1 + prototype.inserter_stack_size_bonus + inserter.force.stack_inserter_capacity_bonus
    end
    return 1 + prototype.inserter_stack_size_bonus + inserter.force.inserter_stack_size_bonus
end
And turns out I'm missing stack size being set via circuit network and who knows what else. I would much prefer to get this value directly from the game, which already has to account for everything that affects it.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Get the inserter's effective stack size limitation

Post by Klonan »

I have added it for the next release

Post Reply

Return to “Implemented mod requests”