plethora app fixes
This commit is contained in:
@@ -3,7 +3,13 @@ _G.requireInjector(_ENV)
|
|||||||
local Point = require('point')
|
local Point = require('point')
|
||||||
local Util = require('util')
|
local Util = require('util')
|
||||||
|
|
||||||
local scanner = device['plethora:scanner'] or error('Plethora scanner required')
|
local device = _G.device
|
||||||
|
local os = _G.os
|
||||||
|
local turtle = _G.turtle
|
||||||
|
|
||||||
|
local scanner = device['plethora:scanner'] or
|
||||||
|
turtle.equip('right', 'plethora:module:2') or
|
||||||
|
error('Plethora scanner required')
|
||||||
|
|
||||||
local crops = {
|
local crops = {
|
||||||
['minecraft:wheat'] =
|
['minecraft:wheat'] =
|
||||||
@@ -30,22 +36,26 @@ local function scan()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function harvest(blocks)
|
local function harvest(blocks)
|
||||||
|
turtle.equip('right', 'minecraft:diamond_pickaxe')
|
||||||
|
|
||||||
Point.eachClosest(turtle.point, blocks, function(b)
|
Point.eachClosest(turtle.point, blocks, function(b)
|
||||||
Util.print(b)
|
Util.print(b)
|
||||||
if b.name == 'minecraft:reeds' then
|
if b.name == 'minecraft:reeds' then
|
||||||
turtle.goto(b)
|
turtle._goto(b)
|
||||||
else
|
else
|
||||||
turtle.goto(Point.above(b))
|
turtle._goto(Point.above(b))
|
||||||
turtle.digDown()
|
turtle.digDown()
|
||||||
turtle.placeDown(crops[b.name].seed)
|
turtle.placeDown(crops[b.name].seed)
|
||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
turtle.equip('right', 'plethora:module:2')
|
||||||
end
|
end
|
||||||
|
|
||||||
turtle.reset()
|
turtle.reset()
|
||||||
local facing = scanner.getBlockMeta(0, 0, 0).state.facing
|
local facing = scanner.getBlockMeta(0, 0, 0).state.facing
|
||||||
pt.heading = Point.facings[facing].heading
|
turtle.point.heading = Point.facings[facing].heading
|
||||||
|
|
||||||
turtle.setPolicy('digOnly')
|
turtle.setPolicy('digOnly')
|
||||||
|
|
||||||
|
|||||||
@@ -414,7 +414,9 @@ local function scan()
|
|||||||
page.statusBar:setValue('status', m)
|
page.statusBar:setValue('status', m)
|
||||||
page.statusBar:draw()
|
page.statusBar:draw()
|
||||||
page:sync()
|
page:sync()
|
||||||
os.sleep(5)
|
os.sleep(3)
|
||||||
|
else
|
||||||
|
page.statusBar:setValue('mining', m)
|
||||||
end
|
end
|
||||||
dirty = true
|
dirty = true
|
||||||
elseif b.action == 'liquid_fuel' then
|
elseif b.action == 'liquid_fuel' then
|
||||||
@@ -442,14 +444,13 @@ local function mineChunk()
|
|||||||
pts[i].y = mining.home.y - 8
|
pts[i].y = mining.home.y - 8
|
||||||
end
|
end
|
||||||
pts[i].y = pts[i].y - mining.home.y -- abs to rel
|
pts[i].y = pts[i].y - mining.home.y -- abs to rel
|
||||||
debug(pts[i])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Point.eachClosest(turtle.point, pts, function(pt)
|
Point.eachClosest(turtle.point, pts, function(pt)
|
||||||
if turtle.isAborted() then
|
if turtle.isAborted() then
|
||||||
error('aborted')
|
error('aborted')
|
||||||
end
|
end
|
||||||
status('scanning ' .. pt.y + mining.home.y - 8 .. ' - ' .. pt.y + mining.home.y + 8)
|
status('scanning ' .. pt.y + mining.home.y - 8 .. '-' .. pt.y + mining.home.y + 8)
|
||||||
|
|
||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
safeGoto(pt.x, pt.z, pt.y)
|
safeGoto(pt.x, pt.z, pt.y)
|
||||||
|
|||||||
Reference in New Issue
Block a user