Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tX, tY, tZ = 0,0,0 --start location of turtle
- local face = 1 --dirrection
- local errorType = 0
- local hitBottom = false
- local bedrock = false
- local sizeX, sizeY = 4,4
- function coalNeeded()
- local coalAmmount = math.ceil((100000 - turtle.getFuelLevel()) / 80)
- return coalAmmount
- end
- function fuel() --refuels the turtle to full
- turtle.digUp()
- if turtle.getFuelLevel() > 50000 then return true end
- emptyInventory()
- local coalTake = coalNeeded()
- turtle.select(2)
- turtle.placeUp()
- while coalTake > 64 do
- turtle.select(3)
- turtle.suckUp(64)
- turtle.refuel()
- coalTake = coalNeeded()
- end
- if coalTake ~= 0 then
- turtle.select(3)
- turtle.suckUp(coalTake)
- turtle.refuel()
- end
- turtle.select(2)
- turtle.digUp()
- end
- function turnR()
- turtle.turnRight()
- if face == 4 then
- face = 1
- else
- face = face + 1
- end
- print("turnR face: ", face)
- end
- function turnL()
- turtle.turnLeft()
- if face == 1 then
- face = 4
- else
- face = face - 1
- end
- print("----turnL face: ", face)
- end
- function move()
- print("move")
- turtle.dig()
- if turtle.detect() then
- sleep(0.10)
- turtle.dig()
- end
- if invFull() then
- emptyInventory()
- end
- fuel()
- if turtle.forward() == false then
- print("turtle cant go forward")
- while not turtle.forward() do
- turtle.attack()
- end
- end
- turtle.digUp()
- turtle.digDown()
- if face == 1 then
- tX = tX + 1
- elseif face == 2 then
- tZ = tZ + 1
- elseif face == 3 then
- tX = tX - 1
- elseif face == 4 then
- tZ = tZ - 1
- else
- print("---face = ", face)
- end
- end
- function emptyInventory() --empties everything in inventory but chest
- turtle.digUp()
- turtle.select(1)
- turtle.placeUp()
- for i = 3, 16 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(1)
- turtle.digUp()
- end
- function invFull()
- for i = 3, 16 do
- if turtle.getItemCount(i) == 0 then
- return false
- end
- end
- return true
- end
- function down()
- if turtle.digDown() == false then
- if turtle.detectDown() == true then
- bedrock = true
- return
- end
- end
- turtle.digDown()
- turtle.down()
- tZ = tZ + 1
- end
- function up()
- turtle.up()
- tZ = tZ - 1
- end
- function quarry()
- hitBottom = false
- bedrock = false
- turtle.digDown()
- turtle.down()
- turtle.digDown()
- while not hitBottom do
- for y = 1, sizeY do
- for x = 1, sizeX do
- if x ~= sizeX then
- print("face: ", face, "x y: ", x, ":", y)
- move()
- elseif y ~= sizeY then
- print("elseif face: ", face)
- -- if y == 2 then sleep(300) end
- if face == 1 then
- turnR()
- move()
- turnR()
- elseif face == 3 then
- print("this should print")
- turnR()
- turnR()
- turnR() turnL()
- --move()
- sleep(30)
- -- turnL()
- else
- print("ERROR FACING IN QUARRY FUNCTION")
- end
- else
- if bedrock == true then
- print("made to bottom")
- --exit while loop
- -- add return back
- else
- turnR()
- turnR()
- down()
- down()
- down()
- end
- end
- end
- end
- end
- end
- function moveChunks()
- end
- function setup()
- local goodChest1 = false
- local goodChest2 = false
- local details = ""
- turtle.select(1)
- if turtle.getItemCount() ~= 0 then
- details = turtle.getItemDetail()
- if (details.nbtHash ~= "2140ff65135fd9bd2d814704d2926a0b") then
- goodChest1 = false
- else
- goodChest1 = true
- end
- end
- turtle.select(2)
- if turtle.getItemCount() ~= 0 then
- details = turtle.getItemDetail()
- if (details.nbtHash ~= "7ca7d17d1bad27a13c95b6672880aabb") then
- goodChest2 = false
- else
- goodChest2 = true
- end
- end
- if (goodChest1 == false) then
- print("slot1 is not white,white,white chest")
- end
- if (goodChest2 == false) then
- print("slot2 is not white,black,white chest")
- end
- if ((goodChest1 and goodChest2) == false) then
- print("press any key to retry")
- os.pullEvent("key")
- setup()
- else
- return true
- end
- end
- ---------------------------------
- print("place white,white,white enderchest in slot 1 and white,black,white enderchest in slot 2")
- print("press any key to continue")
- os.pullEvent("key")
- setup()
- quarry()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement