[2.0.6] Add details to InserterPrototype insert_position/pickup_position

robot256
Smart Inserter
Smart Inserter
Posts: 1269
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[2.0.6] Add details to InserterPrototype insert_position/pickup_position

Post 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.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 151
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

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

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4178
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
curiosity
Filter Inserter
Filter Inserter
Posts: 690
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

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

Post 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.
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 151
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

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

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4178
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post by boskid »

In 2.0.66 this restriction for pickup/insert positions will not be present anymore.
Bilka
Factorio Staff
Factorio Staff
Posts: 3636
Joined: Sat Aug 13, 2016 9:20 am
Contact:

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

Post by Bilka »

I suppose this is resolved then, thank you boskid.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Resolved Requests”