surface.find_entity - How do I find anything?

Place to get help with not working mods / modding interface.
Post Reply
Zillo7
Inserter
Inserter
Posts: 22
Joined: Sun May 14, 2017 10:45 pm
Contact:

surface.find_entity - How do I find anything?

Post by Zillo7 »

I'm using surface.find_entity to check if there's an ore object at a specific point before placing a new ore of my own. However the script I'm using cannot detect multiple ore types, so I end up placing multiple ore objects on the same square. How do I search for and get anything that might be at a specific position?

Code: Select all

local adjacentEntity = global.world.find_entity("MyType", Position)<-- I want to retrieve ANYTHING that might be at this point
       if not adjacentEntity then
       --add new ore here
       local newOre = global.world.create_entity{name = global.oreType, position = Position, amount = global.spreadAmount}
       table.insert(global.oreList, newOre)
	   end


Post Reply

Return to “Modding help”