No-insert flag?

Place to get help with not working mods / modding interface.
User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

No-insert flag?

Post 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.
User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

Re: No-insert flag?

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15998
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: No-insert flag?

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

Re: No-insert flag?

Post 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.
Post Reply

Return to “Modding help”