Page 1 of 1
How to get inserter's current stack_size_bonus?
Posted: Fri Nov 05, 2021 2:10 am
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...
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 5:54 am
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.
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 6:03 am
by meifray
so..is that mean the easy and most pratical way to know current max stack size is iterate values through inserter_stack_size_override?
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 4:41 pm
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.
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 5:55 pm
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.
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 6:12 pm
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?
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 6:17 pm
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)
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 6:34 pm
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?
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 8:19 pm
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.
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 11:35 pm
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.
Re: How to get inserter's current hand size?
Posted: Fri Nov 05, 2021 11:38 pm
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?
Re: How to get inserter's current hand size?
Posted: Sat Nov 06, 2021 3:03 am
by SoShootMe
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).
Re: How to get inserter's current hand size?
Posted: Sat Nov 06, 2021 8:00 am
by meifray
ok,now I post it in Modding interface requests
viewtopic.php?f=28&t=100526