You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
791 B
28 lines
791 B
local component = require('component')
|
|
|
|
local geo = component.geolyzer
|
|
|
|
---Scan 64 blocks south and return farthest found ore
|
|
---@param depth number how many block deep to scan
|
|
---@param y_offset number y offset, 0 means same height as the robot, 1 means the layer above the robot
|
|
---@return integer
|
|
local function deep_scan(depth, y_offset)
|
|
local results = geo.scan(0, 1, y_offset, 1, depth, 1)
|
|
|
|
local max_depth = 0
|
|
for i = 1, depth do
|
|
if results[i] >= 2 and results[i] ~= 100 then -- 100 is lava or water, ignore that
|
|
if i > max_depth then
|
|
max_depth = i
|
|
end
|
|
-- print("Got " .. results[i] .. " at " .. i .. " (y+" .. y_offset .. ")")
|
|
end
|
|
end
|
|
|
|
return max_depth
|
|
end
|
|
|
|
return {
|
|
deep_scan = deep_scan
|
|
}
|