Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This program tells the turtle to dig a quarry with specific dimensions
- x is the horizontal space to the right of the turtle plus the block in front
- y is the depth of the quarry
- z is the space in front of the turtle
- ]]
- --[[ Functions ]]
- -- Breaks a 3 block tall column in front of the turtle and moves forward 1
- local function fwdThree()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.digUp()
- turtle.digDown()
- end
- local function fwd()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- local function dwn()
- while not turtle.down() do
- turtle.digDown()
- end
- end
- local function up()
- while not turtle.up() do
- turtle.digUp()
- end
- end
- local function enoughFuel(x, y, z)
- return true
- end
- --[[ Main ]]
- -- Ask for dimensions
- print("How much in front of me? (z)")
- local z = read()
- print("How much horizontal space? (x)")
- local x = read()
- print("How deep? (y)")
- local y = read()
- -- Check fuel
- if not enoughFuel(x, y, z) then
- print("Please refuel")
- end
- -- Dig
- fwd() -- Move into quarry space
- up()
- local y_threes = y / 3
- local y_remainder = y % 3
- for i = 1, y_threes do
- dwn()
- dwn()
- dwn()
- turtle.digDown()
- -- Dig out layer
- for k = 1, x - 1 do
- for j = 1, z - 1 do
- fwdThree()
- end
- for j = 1, z - 1 do
- turtle.back()
- end
- turtle.turnRight()
- fwdThree()
- turtle.turnLeft()
- end
- for j = 1, z - 1 do
- fwdThree()
- end
- for j = 1, z - 1 do
- turtle.back()
- end
- turtle.turnLeft()
- for k = 1, x - 1 do
- fwd()
- end
- turtle.turnRight()
- end
- for i = 1, y_remainder do
- dwn()
- end
- turtle.digDown()
- -- Dig out layer
- for k = 1, x - 1 do
- for j = 1, z - 1 do
- fwdThree()
- end
- for j = 1, z - 1 do
- turtle.back()
- end
- turtle.turnRight()
- fwdThree()
- turtle.turnLeft()
- end
- for j = 1, z - 1 do
- fwdThree()
- end
- for j = 1, z - 1 do
- turtle.back()
- end
- turtle.turnLeft()
- for k = 1, x - 1 do
- fwd()
- end
- turtle.turnRight()
- for i = 1, y - 1 do
- up()
- end
- turtle.back()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement