How to get inserter's current stack_size_bonus?

Place to get help with not working mods / modding interface.
Post Reply
meifray
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sat May 29, 2021 6:12 pm
Contact:

How to get inserter's current stack_size_bonus?

Post by meifray »

like I do can access to inserter capacity bonus in LuaForce,but I cannot get hand_sizestack_size_bonus in prototype,but we do have stack to indicate which bonus its apply to tho...
Last edited by meifray on Sat Nov 06, 2021 8:02 am, edited 1 time in total.

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 491
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: How to get inserter's current hand size?

Post by Silari »

If you mean what the stack size of an inserter is currently restricted to, it's at https://lua-api.factorio.com/latest/Lua ... e_override

https://lua-api.factorio.com/latest/Lua ... olBehavior has the functions to see if it's set to get the stack size from the circuit network.

If you're trying to figure out which bonus the inserter uses, there's the stack property on the prototype which says whether it uses the bonus for normal or stack inserters.

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

Re: How to get inserter's current hand size?

Post by meifray »

Silari wrote: ↑
Fri Nov 05, 2021 5:54 am
If you mean what the stack size of an inserter is currently restricted to, it's at https://lua-api.factorio.com/latest/Lua ... e_override

https://lua-api.factorio.com/latest/Lua ... olBehavior has the functions to see if it's set to get the stack size from the circuit network.

If you're trying to figure out which bonus the inserter uses, there's the stack property on the prototype which says whether it uses the bonus for normal or stack inserters.
so..is that mean the easy and most pratical way to know current max stack size is iterate values through inserter_stack_size_override?

mrvn
Smart Inserter
Smart Inserter
Posts: 5710
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: How to get inserter's current hand size?

Post by mrvn »

Don't think so. The override is just that, the override, not the maximum.

You should check the stack property and then the relevant bonus in the force if I understand Silari right.

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

Re: How to get inserter's current hand size?

Post by meifray »

mrvn wrote: ↑
Fri Nov 05, 2021 4:41 pm
Don't think so. The override is just that, the override, not the maximum.

You should check the stack property and then the relevant bonus in the force if I understand Silari right.
well,if I have a super stack inserter that has base hand size 50,and can be benefit from stack inserter bonus(assume I got 3),then it should have up to 53 capacity,

then cause the entity prototype don`t have the key hand_size,so even if I get inserter capacity bouns from LuaForce,I still don`t know what base and max capacity is.

mrvn
Smart Inserter
Smart Inserter
Posts: 5710
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: How to get inserter's current hand size?

Post by mrvn »

meifray wrote: ↑
Fri Nov 05, 2021 5:55 pm
mrvn wrote: ↑
Fri Nov 05, 2021 4:41 pm
Don't think so. The override is just that, the override, not the maximum.

You should check the stack property and then the relevant bonus in the force if I understand Silari right.
well,if I have a super stack inserter that has base hand size 50,and can be benefit from stack inserter bonus(assume I got 3),then it should have up to 53 capacity,

then cause the entity prototype don`t have the key hand_size,so even if I get inserter capacity bouns from LuaForce,I still don`t know what base and max capacity is.
The "hand_size" in the prototype is how big the hand part of the inserter is graphically. So it exists but is something completely different.

I think the value you are looking for is:

Code: Select all

stack_size_bonus

Type: ItemCountType
Default: 0
Stack size bonus that is inherent to the prototype without having to be researched. 
Your super stack inserter would have a stack_size_bonus of 49 or not?

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

Re: How to get inserter's current hand size?

Post by meifray »

mrvn wrote: ↑
Fri Nov 05, 2021 6:12 pm
meifray wrote: ↑
Fri Nov 05, 2021 5:55 pm
mrvn wrote: ↑
Fri Nov 05, 2021 4:41 pm
Don't think so. The override is just that, the override, not the maximum.

You should check the stack property and then the relevant bonus in the force if I understand Silari right.
well,if I have a super stack inserter that has base hand size 50,and can be benefit from stack inserter bonus(assume I got 3),then it should have up to 53 capacity,

then cause the entity prototype don`t have the key hand_size,so even if I get inserter capacity bouns from LuaForce,I still don`t know what base and max capacity is.
The "hand_size" in the prototype is how big the hand part of the inserter is graphically. So it exists but is something completely different.

I think the value you are looking for is:

Code: Select all

stack_size_bonus

Type: ItemCountType
Default: 0
Stack size bonus that is inherent to the prototype without having to be researched. 
Your super stack inserter would have a stack_size_bonus of 49 or not?
well,ya,it is what I really wnat to meant.
so it is


1 + stack_size_bonus(49) + 3(from bonus)
Last edited by meifray on Fri Nov 05, 2021 6:30 pm, edited 1 time in total.

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

Re: How to get inserter's current hand size?

Post by SoShootMe »

mrvn wrote: ↑
Fri Nov 05, 2021 6:12 pm
I think the value you are looking for is:

Code: Select all

stack_size_bonus

Type: ItemCountType
Default: 0
Stack size bonus that is inherent to the prototype without having to be researched. 
But this doesn't appear to be available at runtime, so it seems not possible to find the current maximum stack size for an arbitrary inserter, 1 + stack_size_bonus + (stack ? stack_inserter_capacity_bonus : inserter_stack_size_bonus), although inserters in the base game don't set stack_size_bonus. Or did I miss something?

mrvn
Smart Inserter
Smart Inserter
Posts: 5710
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: How to get inserter's current hand size?

Post by mrvn »

game.entity_prototypes[entity.name]?

The vanilla stack-inserter seems to only use the bonus. Default size is 1 and unlocking the tech adds 1 bonus. Inserter capacity techs add more bonus for the stack inserter too.

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 491
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: How to get inserter's current hand size?

Post by Silari »

SoShootMe wrote: ↑
Fri Nov 05, 2021 6:34 pm
mrvn wrote: ↑
Fri Nov 05, 2021 6:12 pm
I think the value you are looking for is:

Code: Select all

stack_size_bonus

Type: ItemCountType
Default: 0
Stack size bonus that is inherent to the prototype without having to be researched. 
But this doesn't appear to be available at runtime, so it seems not possible to find the current maximum stack size for an arbitrary inserter, 1 + stack_size_bonus + (stack ? stack_inserter_capacity_bonus : inserter_stack_size_bonus), although inserters in the base game don't set stack_size_bonus. Or did I miss something?
Isn't documented in https://lua-api.factorio.com/latest/Lua ... otype.html (and trying it in game says stack_size_bonus key doesn't exist) so it's probably not been made available. Seems more an oversight than anything, as almost everything else is available there, and that particular property doesn't seem used in vanilla. A modding interface request would likely get it put in fairly quick.

mrvn
Smart Inserter
Smart Inserter
Posts: 5710
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: How to get inserter's current hand size?

Post by mrvn »

Silari wrote: ↑
Fri Nov 05, 2021 11:35 pm
SoShootMe wrote: ↑
Fri Nov 05, 2021 6:34 pm
mrvn wrote: ↑
Fri Nov 05, 2021 6:12 pm
I think the value you are looking for is:

Code: Select all

stack_size_bonus

Type: ItemCountType
Default: 0
Stack size bonus that is inherent to the prototype without having to be researched. 
But this doesn't appear to be available at runtime, so it seems not possible to find the current maximum stack size for an arbitrary inserter, 1 + stack_size_bonus + (stack ? stack_inserter_capacity_bonus : inserter_stack_size_bonus), although inserters in the base game don't set stack_size_bonus. Or did I miss something?
Isn't documented in https://lua-api.factorio.com/latest/Lua ... otype.html (and trying it in game says stack_size_bonus key doesn't exist) so it's probably not been made available. Seems more an oversight than anything, as almost everything else is available there, and that particular property doesn't seem used in vanilla. A modding interface request would likely get it put in fairly quick.
It's in the wiki:

https://wiki.factorio.com/Prototype/Ins ... size_bonus

Obsolete and removed?

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

Re: How to get inserter's current hand size?

Post by SoShootMe »

mrvn wrote: ↑
Fri Nov 05, 2021 11:38 pm
https://wiki.factorio.com/Prototype/Ins ... size_bonus

Obsolete and removed?
On the contrary, it was apparently added in 1.1.
Silari wrote: ↑
Fri Nov 05, 2021 11:35 pm
Isn't documented in https://lua-api.factorio.com/latest/Lua ... otype.html (and trying it in game says stack_size_bonus key doesn't exist) so it's probably not been made available. Seems more an oversight than anything, as almost everything else is available there, and that particular property doesn't seem used in vanilla. A modding interface request would likely get it put in fairly quick.
That's what I found, but I wasn't sure if I'd missed it or if there was some other way to get it. I agree it seems an oversight. I expect making it available would be straightforward.

In short, I think the answer to meifray's question is: you can't, unless you know the prototype's stack_size_bonus or assume it is zero (the default and true in the base game), but you should raise a modding interface request (it wouldn't harm to explain why you want to know the current maximum stack size).

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

Re: How to get inserter's current hand size?

Post by meifray »

ok,now I post it in Modding interface requests
viewtopic.php?f=28&t=100526

Post Reply

Return to β€œModding help”