Page 1 of 1

wtf is item-request-proxy

Posted: Mon Jan 30, 2017 7:41 am
by Adil
So, I've come across this type of entity in the base mod, but it gives off no information on what it is and how to use it.
I've found this thread but, apparently, it did not have consequence.
I've been unable to create this entity with a script, it just gives uninformative error "entity creation failed" or somesuch.
In the linked thread it is mentioned, that this is possible, but answer to how is on third party site with mandatory login.

So how can I create one and what is it good for?

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 8:13 am
by DaveMcW
It's a blue triangle that requests modules for assembling machines. It's an entity because you can click to cancel it. Although I don't see why anyone would want do that.

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 9:00 am
by Adil
So, how can I create one with a script and what use it may have?

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 9:33 am
by posila
Hi, I can see item-request-proxy is missing in create_entity documentation: http://lua-api.factorio.com/latest/LuaS ... ate_entity

So, the way to create it through script is:

Code: Select all

game.player.surface.create_entity{name="item-request-proxy", target=entity, modules={{item = "productivity-module", count=2}}, position=entity.position, force=entity.force}
It can be used to request item delivery from logistic network into target entity. It will always try to fill module slots first.

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 12:24 pm
by Adil
Thank you.

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 6:55 pm
by orzelek
Would this be able to request ammo from logistic network for gun turrets or it's limited to modules?

Re: wtf is item-request-proxy

Posted: Mon Jan 30, 2017 7:00 pm
by posila
It is intended for modules in blueprints, but I think it would work for ammo too.

EDIT: Tried it and it works. Request is handled by construction robots, thought. Again - intended for blueprints, blueprints are built by construction robots.

Re: wtf is item-request-proxy

Posted: Wed Feb 01, 2017 11:53 pm
by aubergine18
So when doing it for ammo, for example, what would the syntax be (I assume it wouldn't be using the "modules" property in the table passed to create_entity)? Use "ammo" instead or something else?

Could it be used to request other things - such as items for normal slots?

Re: wtf is item-request-proxy

Posted: Thu Feb 02, 2017 12:03 am
by posila
aubergine18 wrote:So when doing it for ammo, for example, what would the syntax be (I assume it wouldn't be using the "modules" property in the table passed to create_entity)? Use "ammo" instead or something else?
No, it is alway "modules", because ... naming things is hard :)

Code for requesting 50 piercing rounds magazines.

Code: Select all

game.player.surface.create_entity{name="item-request-proxy", target=entity, modules={{item = "piercing-rounds-magazine", count=50}}, position=entity.position, force=entity.force}

Re: wtf is item-request-proxy

Posted: Thu Feb 02, 2017 12:09 am
by aubergine18
Awesome, thanks!!