LuaEntityPrototype.stack_size_bonus :: uint32

Post Reply
meifray
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sat May 29, 2021 6:12 pm
Contact:

LuaEntityPrototype.stack_size_bonus :: uint32

Post 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

curiosity
Filter Inserter
Filter Inserter
Posts: 324
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Post 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
?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Post by DaveMcW »

EntityPrototype.stack_size_bonus was added in 1.1, but it is not readable in control.lua.

curiosity
Filter Inserter
Filter Inserter
Posts: 324
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Post by curiosity »

That makes a lot more sense.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 475
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: LuaEntityPrototype.stack_size_bonus :: uint32

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

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: LuaEntityPrototype.stack_size_bonus :: uint32

Post by Bilka »

Description was fixed in the docs, so I am moving this to implemented.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”