Look for all machines with name "x"

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Look for all machines with name "x"

Post by ficolas »

Well so I need to ejecute a lua code where every machine X is placed
I asked this, and kovarex said that I can use the findentity function, but that this will be slow, How do I use this?
Also, I can use the onplace event, to record the position of the machine on a file, using the file API, but in order to do this, ill need to check if the entity is still there, I could use isvalid, but that wont say that the name is "x", it will only say that there is an entity.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Look for all machines with name "x"

Post by kovarex »

You can manage the list of all entities created by player by catching events oncreated, onmined and onbuild ...

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Look for all machines with name "x"

Post by ficolas »

I think the onmined event isnt at the wiki

Post Reply

Return to “Modding help”