Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getEntityCount(range, x, y, z, entity)
- local t = peripheral.find("EntityDetector")
- if not t then
- error("No EntityDetector detected !")
- end
- if not entity then
- return false
- end
- local tEntities = {}
- local nEntityCount = 0
- local f = t.getEntityList(range, x, y, z)
- for k, v in pairs(f) do
- if v.type == entity then
- nEntityCount = nEntityCount + 1
- table.insert(tEntities, v.type)
- end
- end
- return nEntityCount, tEntities
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement