finder
This commit is contained in:
27
miners/autorun/startup.lua
Normal file
27
miners/autorun/startup.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local Util = require('util')
|
||||
|
||||
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
|
||||
@@ -1,8 +1,6 @@
|
||||
local GPS = require('gps')
|
||||
local Util = require('util')
|
||||
|
||||
local device = _G.device
|
||||
local turtle = _G.turtle
|
||||
|
||||
if device.neuralInterface and device.wireless_modem then
|
||||
local ni = require('neural.interface')
|
||||
@@ -30,26 +28,3 @@ if device.neuralInterface and device.wireless_modem then
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user