surface.find_entity - How do I find anything?
Posted: Fri Jun 02, 2017 1:37 am
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