Page 1 of 1

entity objects of items on transport line (0.12.27)

Posted: Sun Mar 20, 2016 3:25 am
by Impatient
Hi,

is there currently (0.12.26/0.12.27) a way of getting a list of entities on a transport line? it seems, former solutions of finding them with game.surface.find_entities and game.surface.find_entities_filtered do not work anymore. once an item is "inserted" into a LuaTransportLine, it is not findable by these functions.

It looks like currently a line transports the items (assumingly) inserted into it, but their entities can not be accessed from outside. But a line or a belt also transports items, which are in the same location, but (assumingly) were not inserted into the line (just somehow happened to end up on the belt). The entities of the later can be accessed via the find_entities functionality.

I can get name and count of items. But to shuffle them around in a proper way, i need access to the entities. e.g. access their health value. access their exact position on the line.

Any ideas?

Thanks

Re: entity objects of items on transport line (0.12.26/0.12.27)

Posted: Sun Mar 20, 2016 1:20 pm
by StanFear
I would suggest looking at the get_contents() function from the LuaTransportLine class

I trust you'll be able to find how to get the LuaTransportLine item ?

Re: entity objects of items on transport line (0.12.26/0.12.27)

Posted: Sun Mar 20, 2016 3:06 pm
by Impatient
you are my man!

Re: entity objects of items on transport line (0.12.26/0.12.27)

Posted: Mon Mar 21, 2016 1:29 am
by Impatient
StanFear wrote:I would suggest looking at the get_contents() function from the LuaTransportLine class
http://lua-api.factorio.com/0.12.27/Lua ... t_contents

Code: Select all

get_contents() → dictionary string → uint

Get counts of all items on this line.

Return value
The counts, indexed by item names.
How is this going to give me the entity objects?

Re: entity objects of items on transport line (0.12.26/0.12.27)

Posted: Mon Mar 21, 2016 8:42 am
by StanFear
Impatient wrote:How is this going to give me the entity objects?
Yeah, sorry, Actually, I think that items on the belts no longer are entities

and getting the positions of items on the line is not possible (well I think, getting the index is, but not the world position)

Sorry, but I don't think what you want to do will be possible ... (at least not yet)

I would suggest to go to the Modding interface requests forum to ask for this (I think there is already a post about getting the position, don't know for the other stuff)