finder
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
local Util = require('util')
|
local Util = require('util')
|
||||||
|
|
||||||
|
local device = _G.device
|
||||||
local turtle = _G.turtle
|
local turtle = _G.turtle
|
||||||
|
|
||||||
if turtle then
|
if turtle then
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ for _, b in pairs(scanner.scan()) do
|
|||||||
fuel = v.turtle.fuel,
|
fuel = v.turtle.fuel,
|
||||||
distance = 0,
|
distance = 0,
|
||||||
point = pt,
|
point = pt,
|
||||||
|
index = Util.size(pool),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -93,7 +94,7 @@ local function hijackTurtle(remoteId)
|
|||||||
return hijack, socket
|
return hijack, socket
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getNextPoint()
|
local function getNextPoint(member)
|
||||||
local z = math.floor(chunkIndex / 3)
|
local z = math.floor(chunkIndex / 3)
|
||||||
local x = chunkIndex % 3
|
local x = chunkIndex % 3
|
||||||
|
|
||||||
@@ -103,7 +104,10 @@ local function getNextPoint()
|
|||||||
os.sleep(3)
|
os.sleep(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { x = gpt.x + (x * 16), y = gpt.y, z = gpt.z + (z * 16) }
|
return {
|
||||||
|
x = gpt.x + (x * 16),
|
||||||
|
y = gpt.y + member.index,
|
||||||
|
z = gpt.z + (z * 16) }
|
||||||
end
|
end
|
||||||
|
|
||||||
local function run(member)
|
local function run(member)
|
||||||
@@ -127,10 +131,9 @@ local function run(member)
|
|||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
local pt = getNextPoint(turtle)
|
local pt = getNextPoint(member)
|
||||||
if pt then
|
if pt then
|
||||||
member.status = 'digging'
|
turtle.gotoY(pt.y)
|
||||||
|
|
||||||
repeat until turtle._goto(pt)
|
repeat until turtle._goto(pt)
|
||||||
|
|
||||||
for _, v in ipairs(locations) do
|
for _, v in ipairs(locations) do
|
||||||
@@ -145,11 +148,11 @@ local function run(member)
|
|||||||
paused = true
|
paused = true
|
||||||
print('found spawner')
|
print('found spawner')
|
||||||
local _, b = next(found)
|
local _, b = next(found)
|
||||||
print(string.format('%s:%s:%s'), b.x, b.y, b.z)
|
print(string.format('%s:%s:%s', b.x, b.y, b.z))
|
||||||
print('press r to continue')
|
print('press r to continue')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
turtle.gotoY(gpt.y)
|
turtle.gotoY(pt.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
if member.fuel < 100 then
|
if member.fuel < 100 then
|
||||||
|
|||||||
Reference in New Issue
Block a user