How to create an infinite chest and set him a filter?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

How to create an infinite chest and set him a filter?

Post by WIZ4 »

I have a command that creates a requester chest with a filter

Code: Select all

/c game.surfaces[1].create_entity{
  name = "logistic-chest-requester", position = {game.player.position.x+3, game.player.position.y},
  force=game.player.force, request_filters={ {index=1, name="iron-plate", count=128} }
}
But if I create an infinite chest with a filter, then the filter is not applied to it

Code: Select all

/c game.surfaces[1].create_entity{    name = "infinity-chest", position = {game.player.position.x+3, game.player.position.y},    force=game.player.force, request_filters={ {index=1, name="iron-plate", count=128} }  }
How do I add a filter to the chest?
My native language is russian. Sorry if my messages are difficult to read.

Bilka
Factorio Staff
Factorio Staff
Posts: 3170
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How to create an infinite chest and set him a filter?

Post by Bilka »

The infinity chest uses another method than the requester chest: http://lua-api.factorio.com/latest/LuaE ... ity_filter that you will have to set that outside of the create_entity function.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: How to create an infinite chest and set him a filter?

Post by Nexela »

Code: Select all

/c game.surfaces[1].create_entity{    name = "infinity-chest", position = {game.player.position.x+3, game.player.position.y},    force=game.player.force }  }.set_infinity_filter(1, "iron-plate")

luc
Fast Inserter
Fast Inserter
Posts: 218
Joined: Sun Jul 17, 2016 9:53 pm
Contact:

Re: How to create an infinite chest and set him a filter?

Post by luc »

Combining both replies, this code works in 0.16.51:

Code: Select all

/c game.surfaces[1].create_entity{ name="infinity-chest", position={game.player.position.x+1, game.player.position.y+1}, force=game.player.force}.set_infinity_filter(1,{index=1,name="iron-plate",count=50})
(Nexela's answer gives an error about the second arg to set_inf_filter being a string instead of a table.)

Post Reply

Return to “Modding help”