How to get and set item-request-proxy slots

Place to get help with not working mods / modding interface.
Post Reply
can00336
Inserter
Inserter
Posts: 28
Joined: Sun Dec 11, 2016 9:39 pm
Contact:

How to get and set item-request-proxy slots

Post by can00336 »

How do you get and set the items in the item request proxy entites?
Attachments
Image1.jpg
Image1.jpg (139.11 KiB) Viewed 1354 times

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: How to get and set item-request-proxy slots

Post by gheift »

Hi can,

use http://lua-api.factorio.com/latest/LuaE ... m_requests

To get the items use something like this:

Code: Select all

/c local p,s=game.player,game.player.selected for w,a in pairs(s.item_requests) do p.print(w .. \": \" .. a) end
To update the items it requests, you have to set the item_requests, not update it:

Code: Select all

/c local p,s=game.player,game.player.selected s.item_requests={["speed-module"] = 2} for w,a in pairs(s.item_requests) do p.print(w .. \": \" .. a) end
To create a proxy for an entity, you have to specify the target and the modules, see also viewtopic.php?f=25&t=40570:

Code: Select all

/c local p,s=game.player,game.player.selected p.surface.create_entity{name="item-request-proxy",target=s,force=s.force,position=s.position,modules={{item="speed-module",count=1}}}

Post Reply

Return to “Modding help”