Get the inserter's effective stack size limitation
Posted: Sat Jan 07, 2023 4:47 pm
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:
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.
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