Files
opus-apps/miners/autorun/startup.lua
kepler155c@gmail.com f3e131ec00 finder
2019-02-16 05:23:12 -05:00

29 lines
609 B
Lua

local Util = require('util')
local device = _G.device
local turtle = _G.turtle
if turtle then
function turtle.scan(blocks)
local pt = turtle.point
local scanner = device['plethora:scanner'] or error('Scanner not equipped')
if not blocks then
return Util.each(scanner:scan(), function(b)
b.x = pt.x + b.x
b.y = pt.y + b.y
b.z = pt.z + b.z
end)
end
return Util.filter(scanner:scan(), function(b)
if blocks[b.name] then
b.x = pt.x + b.x
b.y = pt.y + b.y
b.z = pt.z + b.z
return true
end
end)
end
end