How to get inserter's current stack_size_bonus?
How to get inserter's current stack_size_bonus?
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.
Re: How to get inserter's current hand size?
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.
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.
Re: How to get inserter's current hand size?
so..is that mean the easy and most pratical way to know current max stack size is iterate values through inserter_stack_size_override?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.
Re: How to get inserter's current hand size?
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.
You should check the stack property and then the relevant bonus in the force if I understand Silari right.
Re: How to get inserter's current hand size?
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.
Re: How to get inserter's current hand size?
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.meifray wrote: βFri Nov 05, 2021 5:55 pmwell,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.
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.
Re: How to get inserter's current hand size?
well,ya,it is what I really wnat to meant.mrvn wrote: βFri Nov 05, 2021 6:12 pmThe "hand_size" in the prototype is how big the hand part of the inserter is graphically. So it exists but is something completely different.meifray wrote: βFri Nov 05, 2021 5:55 pmwell,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.
I think the value you are looking for is:Your super stack inserter would have a stack_size_bonus of 49 or not?Code: Select all
stack_size_bonus Type: ItemCountType Default: 0 Stack size bonus that is inherent to the prototype without having to be researched.
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.
Re: How to get inserter's current hand size?
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 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.
Re: How to get inserter's current hand size?
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.
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.
Re: How to get inserter's current hand size?
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.SoShootMe wrote: βFri Nov 05, 2021 6:34 pmBut 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 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.
Re: How to get inserter's current hand size?
It's in the wiki:Silari wrote: βFri Nov 05, 2021 11:35 pmIsn'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.SoShootMe wrote: βFri Nov 05, 2021 6:34 pmBut 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 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.
https://wiki.factorio.com/Prototype/Ins ... size_bonus
Obsolete and removed?
Re: How to get inserter's current hand size?
On the contrary, it was apparently added in 1.1.mrvn wrote: βFri Nov 05, 2021 11:38 pm https://wiki.factorio.com/Prototype/Ins ... size_bonus
Obsolete and removed?
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.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.
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).
Re: How to get inserter's current hand size?
ok,now I post it in Modding interface requests
viewtopic.php?f=28&t=100526
viewtopic.php?f=28&t=100526