Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Preface
- ---------------------------------------
- print("Welcome to the Quarry 2.0")
- term.setTextColor(colors.white)
- print("This quarry is designed to mine along the x, y and z coordinates that you write below.")
- term.setTextColor(colors.green)
- print()
- print("Legond")
- print("x = distance forwards")
- print("y = depth below")
- print("z = distance left")
- print()
- term.setTextColor(colors.orange)
- print("Please place a chest behind the Quarry Turtle and a chest above.")
- term.setTextColor(colors.gray)
- print("Coordinates: ")
- Cords = read()
- --Variables
- ---------------------------------------
- --x Distance Forwards
- --y Distance Downwards
- --z Distance Left
- --hx Home X
- --hy Home Y
- --hz Home Z
- --lsx Present X
- --lsy Present Y
- --lsz Present Z
- --Functions
- ---------------------------------------
- local tArgs = {...}
- --"On the Road"
- function forward()
- for i = 1, tArgs[1]-1 do
- turtle.dig()
- turtle.forward()
- if i == 0 then
- D = false --Code Completed
- end
- end
- end
- --"Veer for the port laddy"
- function left()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- D = false --Code Completed
- end
- --"Right's on the mark matey"
- function right()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- D = false --There's a trend...
- end
- --"Losing Altitude"
- function down()
- turtle.digDown()
- turtle.down()
- turtle.down()
- D = false
- end
- --"Honey, I'm coming home!"
- function home(hx,hy,hz)
- lsx, lsy, lsz = gps.locate(10,false)
- difx = lsx - hx
- dify = lsy - hy
- difz = lsz - hz
- turtle.forward()
- x1, y1, z1 = gps.locate(10,false)
- f = 0
- if x1 < x then f = 3 end
- if x1 > x then f = 1 end
- if z1 < z then f = 0 end
- if z1 > z then f = 2 end
- while f > 0 do
- turtle.turnLeft()
- f = f-1
- end
- if divz > 0 then
- turtle.forward()
- difz = difz -1
- end
- turtle.turnLeft()
- if divx > 0 then
- turtle.forward()
- difx = difx -1
- end
- turtle.turnLeft()
- if difz < 0 then
- turtle.forward()
- difz = difz +1
- end
- turtle.turnLeft()
- if difx < 0 then
- turtle.forward()
- difx = difx +1
- end
- while dify > 0 do
- turtle.down()
- dify = dify -1
- end
- while dify <= 0 do
- turtle.up()
- dify = dify +1
- end
- if {lsx, lsy, lsz} == {hx, hy, hz} then
- D = false
- end
- end
- --"Good nut, bad nut, good nut, odd nut"
- function even(q)
- if (q % 2) == 0 then --More Problems
- qb = true --If even
- else
- qb = false --If odd
- D = false
- end
- end
- --Main Code
- ---------------------------------------
- --"Setting up Shop"
- hx, hy, hz = gps.locate(10)
- --"Gold Rush"
- local leftTurns = 0
- local rightTurns = 0
- if even(tArgs[1]) == true then
- leftTurns = tArgs[3]/2
- rightTurns = leftTurns
- else
- leftTurns = (tArgs[3]/2) + 0.5
- rightTurns = leftTurns - 1
- end
- local s = tArgs[2]
- --Layer Function
- function Layer()
- repeat
- --Moves forwards and then turns left
- if leftTurns > 0 then --ERROR DAMN
- forward()
- left()
- leftTurns = leftTurns -1
- --Moves forwards and then turns right
- elseif rightTurns > 0 then
- forward()
- left()
- right()
- rightTurns = rightTurns -1
- end
- until rightTurns == 0
- turtle.turnRight(2)
- turtle.forward(tArg[1]-1)
- turtle.turnLeft()
- turtle.forward(tArg[3]-1)
- turtle.turnRight()
- down()
- end
- local s = 0
- local l = 0
- repeat
- Layer()
- s = s-1
- l = l+1
- until s == 0
- --"Coming Home"
- local turtleslots = {...}
- while turtle.getItemCount(16) > 0 do
- home(hx, hy, hz)
- --need to set face direction
- --turtle.suckUp(63) ???
- turtle.drop(turtleslot[2])
- turtle.drop(turtleslot[3])
- turtle.drop(turtleslot[4])
- turtle.drop(turtleslot[5])
- turtle.drop(turtleslot[6])
- turtle.drop(turtleslot[7])
- turtle.drop(turtleslot[8])
- turtle.drop(turtleslot[9])
- turtle.drop(turtleslot[10])
- turtle.drop(turtleslot[11])
- turtle.drop(turtleslot[12])
- turtle.drop(turtleslot[13])
- turtle.drop(turtleslot[14])
- turtle.drop(turtleslot[15])
- turtle.drop(turtleslot[16])
- turtle.turnRight(2)
- turtle.down(l)
- end
- --"Recharge"
- while turtle.getFuelLevel() == 0 do
- turtle.refuel(63)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement