.
This commit is contained in:
parent
49da7a7a44
commit
116adfc3dc
@ -50,6 +50,23 @@ function splitStringToArray(input_str)
|
|||||||
return table
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--secure digging wrappers
|
||||||
|
local function secureDig()
|
||||||
|
while turtle.detect() do
|
||||||
|
turtle.dig()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function secureDigUp()
|
||||||
|
while turtle.detectUp() do
|
||||||
|
turtle.digUp()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function secureDigDown()
|
||||||
|
while turtle.detectDown() do
|
||||||
|
turtle.digDown()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
clearDisplay=clearDisplay,
|
clearDisplay=clearDisplay,
|
||||||
@ -59,4 +76,7 @@ return
|
|||||||
readFileOneline=readFileOneline,
|
readFileOneline=readFileOneline,
|
||||||
readFileAll=readFileAll,
|
readFileAll=readFileAll,
|
||||||
splitStringToArray=splitStringToArray,
|
splitStringToArray=splitStringToArray,
|
||||||
|
secureDig=secureDig,
|
||||||
|
secureDigUp=secureDigUp,
|
||||||
|
secureDigDown=secureDigDown,
|
||||||
}
|
}
|
@ -93,9 +93,9 @@ local function storeItems()
|
|||||||
if itemDetail ~= nil then
|
if itemDetail ~= nil then
|
||||||
if itemDetail.name == "minecraft:chest" then
|
if itemDetail.name == "minecraft:chest" then
|
||||||
turtle.up()
|
turtle.up()
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.up()
|
turtle.up()
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.placeUp()
|
turtle.placeUp()
|
||||||
--TODO save in list, where chest is placed
|
--TODO save in list, where chest is placed
|
||||||
chestAvailable = true
|
chestAvailable = true
|
||||||
@ -153,7 +153,7 @@ local function recursiveOreMining()
|
|||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
flockFound, blockData = turtle.inspect()
|
flockFound, blockData = turtle.inspect()
|
||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
turtle.dig()
|
basic.secureDig()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
turtle.back()
|
turtle.back()
|
||||||
@ -162,7 +162,7 @@ local function recursiveOreMining()
|
|||||||
|
|
||||||
flockFound, blockData = turtle.inspectUp()
|
flockFound, blockData = turtle.inspectUp()
|
||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.up()
|
turtle.up()
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
turtle.down()
|
turtle.down()
|
||||||
@ -170,7 +170,7 @@ local function recursiveOreMining()
|
|||||||
|
|
||||||
flockFound, blockData = turtle.inspectDown()
|
flockFound, blockData = turtle.inspectDown()
|
||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
turtle.digDown()
|
basic.secureDigDown()
|
||||||
turtle.down()
|
turtle.down()
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
turtle.up()
|
turtle.up()
|
||||||
@ -182,10 +182,10 @@ local function mineRow()
|
|||||||
for i=state["dataCurrentPathProgress"], state["dataGoalPathProgress"]-2 do
|
for i=state["dataCurrentPathProgress"], state["dataGoalPathProgress"]-2 do
|
||||||
print("row: " .. state["dataCurrentRow"]+1 .. "/" .. state["dataGoalRows"] .. ", pathProgress: " .. state["dataCurrentPathProgress"]+1 .. "/" .. state["dataGoalPathProgress"])
|
print("row: " .. state["dataCurrentRow"]+1 .. "/" .. state["dataGoalRows"] .. ", pathProgress: " .. state["dataCurrentPathProgress"]+1 .. "/" .. state["dataGoalPathProgress"])
|
||||||
|
|
||||||
turtle.dig()
|
basic.secureDig()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.digDown()
|
basic.secureDigDown()
|
||||||
|
|
||||||
--check current mining step for ore
|
--check current mining step for ore
|
||||||
turtle.up()
|
turtle.up()
|
||||||
@ -232,10 +232,10 @@ local function mineChunk()
|
|||||||
--go to next row
|
--go to next row
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
for j=0, 2 do
|
for j=0, 2 do
|
||||||
turtle.dig()
|
basic.secureDig()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.digDown()
|
basic.secureDigDown()
|
||||||
end
|
end
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
end
|
end
|
||||||
@ -260,10 +260,10 @@ local function mineFibo()
|
|||||||
--go to next chunk
|
--go to next chunk
|
||||||
turtle.turnRight()
|
turtle.turnRight()
|
||||||
for j=1, 2 do
|
for j=1, 2 do
|
||||||
turtle.dig()
|
basic.secureDig()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
turtle.digUp()
|
basic.secureDigUp()
|
||||||
turtle.digDown()
|
basic.secureDigDown()
|
||||||
end
|
end
|
||||||
|
|
||||||
--get next fibo number
|
--get next fibo number
|
||||||
|
@ -56,6 +56,7 @@ local function placeTree()
|
|||||||
if not blockFound then
|
if not blockFound then
|
||||||
turtle.up()
|
turtle.up()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
|
turtle.suckDown()
|
||||||
for i=0, 3 do
|
for i=0, 3 do
|
||||||
turtle.placeDown()
|
turtle.placeDown()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
@ -82,7 +83,7 @@ local function emptyInventory()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function brulijam()
|
function main()
|
||||||
if fallingTreeModUsed then
|
if fallingTreeModUsed then
|
||||||
while true do
|
while true do
|
||||||
blockFound, blockData = turtle.inspect()
|
blockFound, blockData = turtle.inspect()
|
||||||
@ -118,4 +119,4 @@ function brulijam()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
brulijam()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user