Page 1 of 1

[2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Sat Oct 19, 2024 2:15 pm
by robot256
Please add some explanation specifically to the InserterPrototype::insert_position specification. I keep getting the error message "Bad insert vector as it isn't a safe distance from the tile edge." I would like to know the formula for good insert vectors rather than using trial and error. Thanks.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Sat Aug 30, 2025 6:25 am
by Osmo
+1, i also got this error Error while running setup for entity prototype "belt-offshoot" (inserter): Bad insert vector as it isn't in safe distance from the tile edge., and it should say what vectors are considered "safe".
Also i think this can also happen at runtime when writing to pickup_position and the same error should be there as well.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Sat Aug 30, 2025 10:14 am
by boskid
Hm, there are so many questions here and the most important asked should be if this restriction is still needed. This logic goes back to 0.11.10 when it was introduced by
0.11.10 wrote:Fixed the problem of stuck inserters when putting stuff on transport belt with direction away from it.
which reaches times when items moved on belts were still item entities changing position (way before transport belt optimization from 0.16.0). I suspect this restriction could be just lifted now as it serves no purpose in current system.

Anyway, check for bad insert vector uses a width of the "item-on-ground" prototype (to be more precise, it takes size of any "item-entity" that was loaded last, it silently assumes there is only one such prototype), adds 0.02 to the width of the item entity to get a margin value and checks if the {x, y} position of the pickup lands at least that far from a tile edge. This check also accounts for inserter tile grid size (for example if the inserter will be built on tile center if its 1x1, or on tile corner if its 2x2). In practice that means the pickup and drop position vector ends must land at least about 0.295 tiles away from any tile edge to be considered safe by this check.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Sat Aug 30, 2025 10:45 am
by curiosity
boskid wrote: Sat Aug 30, 2025 10:14 am Anyway, check for bad insert vector uses a width of the "item-on-ground" prototype (to be more precise, it takes size of any "item-entity" that was loaded last, it silently assumes there is only one such prototype), adds 0.02 to the width of the item entity to get a margin value and checks if the {x, y} position of the pickup lands at least that far from a tile edge. This check also accounts for inserter tile grid size (for example if the inserter will be built on tile center if its 1x1, or on tile corner if its 2x2). In practice that means the pickup and drop position vector ends must land at least about 0.295 tiles away from any tile edge to be considered safe by this check.
Oh, hence the seemingly-arbitrary 1.2 drop position of the vanilla inserters. It lands 0.3 tiles from the edge.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Sat Aug 30, 2025 12:35 pm
by Osmo
boskid wrote: Sat Aug 30, 2025 10:14 am Hm, there are so many questions here and the most important asked should be if this restriction is still needed. This logic goes back to 0.11.10 when it was introduced by
0.11.10 wrote:Fixed the problem of stuck inserters when putting stuff on transport belt with direction away from it.
which reaches times when items moved on belts were still item entities changing position (way before transport belt optimization from 0.16.0). I suspect this restriction could be just lifted now as it serves no purpose in current system.
Thanks for the quick explanation. I suppose this would also not work as intended with placeable-off-grid flag, so removing the restriction would be a good option, also considering vector_to_place_result allows arbitrary positions and that doesn't seem to cause any issues with belts.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Mon Sep 01, 2025 6:42 am
by boskid
In 2.0.66 this restriction for pickup/insert positions will not be present anymore.

Re: [2.0.6] Add details to InserterPrototype insert_position/pickup_position

Posted: Wed Sep 03, 2025 4:04 pm
by Bilka
I suppose this is resolved then, thank you boskid.