Page 1 of 1

surface.find_entity - How do I find anything?

Posted: Fri Jun 02, 2017 1:37 am
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

Re: surface.find_entity - How do I find anything?

Posted: Sat Jun 03, 2017 3:42 am
by DaveMcW