Page 1 of 1

No-insert flag?

Posted: Sat Jan 21, 2017 12:27 pm
by Sirenfal
Is there a way to stop inserters from picking up a certain type of item, or a specific item-on-ground entity? I have a custom item-entity for dropped items and certain items that are only spawned with...

Code: Select all

{
	type = "item-entity",
	name = "item-pickup-only",
	flags = {"placeable-off-grid", "not-on-map", "not-blueprintable", "not-deconstructable"},
	collision_box = {{-0.14, -0.14}, {0.14, 0.14}},
	selection_box = {{-0.17, -0.17}, {0.17, 0.17}}
},

surface.create_entity({name='item-pickup-only', stack={name='some-item'}, ...)
The goal is for only the player to be able to pick up these items.

Thanks.

Re: No-insert flag?

Posted: Sat Jan 21, 2017 1:09 pm
by Sirenfal
I was able to get the behavior I wanted by spawning an operable=false, bar=0 container on top of the item. Since inserters prefer containers first, this blocks them from picking up the item. The player has no need to walk over the item because it's actually a trigger for something else.

Thanks anyway.

Re: No-insert flag?

Posted: Sat Jan 21, 2017 4:03 pm
by Rseding91
No. The item can still be deconstructed in your "found a way" example as well. Additionally it depends on the entity creation order as to what entity an inserter will pick when it tries to grab something off a tile.

Nothing in the game is built with the concept of limiting what or who can pick up what item.

Re: No-insert flag?

Posted: Sat Jan 21, 2017 4:09 pm
by Sirenfal
The item isn't deconstructable because I set the not-deconstructable flag on the pickup entity. I tested it with the deconstruction planner. Is there another way to flag an item to be picked up by a construction robot?

As for the container workaround; it works reliably as long as the container is created before the item is, which is guaranteed every time. I realize it's undefined behavior, but if it changes I'll change the mod as needed.