Page 1 of 1

[0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 4:08 pm
by AmatorPhasma
Hi,

I think I found a bug again :?

What?
If I give an Inserter with the drop_target of the type: transport-belt, underground-belt or splitter a item stack in the hand by script or console. it has a unexpected behavior as you can see in the attached gif.

Reproduce
- Load the attached save
- execute the following command in the console:

Info
- This only happens if the stack size is equal to (and only than): 1 + force.inserter_stack_size_bonus (like shown in the tooltip)

What I expect?
- like if it has an item stack with size < 1 + force.inserter_stack_size_bonus, wait until the last item is on the belt.

Code: Select all

/c
local surface = game.surfaces[1]
local inserters = surface.find_entities_filtered({type='inserter'})
local item_stack = {name = 'coal', count = 3}
for _, inserter in pairs(inserters) do
    if inserter.unit_number == 96 then
        if inserter.drop_target then
             if not inserter.held_stack.valid_for_read then
                 if inserter.held_stack.can_set_stack(item_stack) then
                     inserter.held_stack.transfer_stack(item_stack)
                 end
            end
        end
    end
end

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:25 pm
by Rseding91
Thanks for the report however I have no idea what you're actually trying to report.

Can you please explain what you expect to happen and what is currently happening?

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:40 pm
by orzelek
Rseding91 wrote: Mon Dec 16, 2019 6:25 pm Thanks for the report however I have no idea what you're actually trying to report.

Can you please explain what you expect to happen and what is currently happening?
I think it's the fact that inserter is given stack of 3 items by script but drops only one first then other two on next swing.

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:40 pm
by AmatorPhasma
Rseding91 wrote: Mon Dec 16, 2019 6:25 pm Thanks for the report however I have no idea what you're actually trying to report.

Can you please explain what you expect to happen and what is currently happening?
What I expect:
if I give a normal inserter an item stack with size 3 (example: coal) in the hand it lays them down on the belt, like if he put them from a chest or crafting-machine.

What happend:
It lay only one item from this item stack with size 3 on the belt, then go back and forth and lay the other two.

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:41 pm
by AmatorPhasma
orzelek wrote: Mon Dec 16, 2019 6:40 pm
Rseding91 wrote: Mon Dec 16, 2019 6:25 pm Thanks for the report however I have no idea what you're actually trying to report.

Can you please explain what you expect to happen and what is currently happening?
I think it's the fact that inserter is given stack of 3 items by script but drops only one first then other two on next swing.
exactly, and it does this only if the item stack has the maximum size of 1+stack bonus for this type of inserter.

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:49 pm
by Rseding91
Ok, I was able to reproduce it and it's now fixed for the next release.

Re: [0.17.79] inserter.held_stack.transfer_stack() unexpected behavior on transport belts

Posted: Mon Dec 16, 2019 6:51 pm
by AmatorPhasma
Rseding91 wrote: Mon Dec 16, 2019 6:49 pm Ok, I was able to reproduce it and it's now fixed for the next release.
That was a fast one :P
Thank you very much! :)