Page 1 of 1

LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Sat Nov 06, 2021 8:00 am
by meifray
why? cause it doesn`t there,which make know current inserter capacity with this value really hard.

discussion from here:
viewtopic.php?f=25&p=555924

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Sat Nov 06, 2021 8:36 am
by curiosity
What's hard about

Code: Select all

    local prototype = (inserter.type == 'entity-ghost'
        and inserter.ghost_prototype or inserter.prototype)
    local stack_size = inserter.inserter_stack_size_override
    if stack_size == 0 then
        local force = inserter.force
        if prototype.stack then
            stack_size = 1 + force.stack_inserter_capacity_bonus
        else
            stack_size = 1 + force.inserter_stack_size_bonus
        end
    end
?

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Sat Nov 06, 2021 8:50 am
by DaveMcW
EntityPrototype.stack_size_bonus was added in 1.1, but it is not readable in control.lua.

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Sat Nov 06, 2021 8:53 am
by curiosity
That makes a lot more sense.

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Mon Nov 22, 2021 5:05 pm
by SoShootMe
Looks like this is implemented in 1.1.47.

I think the description could do with some work though...
https://lua-api.factorio.com/1.1.47/LuaEntityPrototype.html#LuaEntityPrototype.inserter_stack_size_bonus wrote: Gets the current stack size bonus of this entity, returns nil if not an inserter.
This sounds dependent on the current applicable inserter capacity bonus, but I would expect it to match:
https://wiki.factorio.com/Prototype/Inserter#stack_size_bonus wrote: Stack size bonus that is inherent to the prototype without having to be researched.

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Posted: Fri Dec 10, 2021 12:50 pm
by Bilka
Description was fixed in the docs, so I am moving this to implemented.