Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function tryRefuel()
- while turtle.getFuelLevel() < 1 do
- for i = 1, 16 do
- turtle.select(i)
- turtle.refuel(1)
- if turtle.getFuelLevel() > 0 then
- break
- end
- end
- turtle.select(1)
- end
- end
- local function up()
- tryRefuel()
- while not turtle.up() do
- turtle.digUp()
- end
- end
- local function down()
- tryRefuel()
- while not turtle.down() do
- turtle.digDown()
- end
- end
- local function forward()
- tryRefuel()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- local function xforward(dist)
- for i = 1, dist do
- forward()
- turtle.digUp()
- turtle.digDown()
- end
- end
- local function rCorner()
- turtle.turnRight()
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- end
- local function lCorner()
- turtle.turnLeft()
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnLeft()
- end
- local size, height = ...
- if size == nil or height == nil then
- print("Usage: vquarry <size> <height>")
- print("Height should be a multiple of 3.")
- return
- end
- size = tonumber(size)
- height = tonumber(height)
- if height < 3 then
- print("Height must be at least 3.")
- return
- end
- turtle.digUp()
- turtle.digDown()
- for y = 3, height, 3 do
- for x = 1, size do
- xforward(size - 1)
- if x == size then
- turtle.turnRight()
- if size % 2 == 1 then
- turtle.turnRight()
- end
- if y + 3 <= height then
- for i = 1, 3 do
- up()
- end
- turtle.digUp()
- end
- elseif x % 2 == 1 then
- rCorner()
- else
- lCorner()
- end
- end
- end
- for y = 4, height, 3 do
- for i = 1, 3 do
- down()
- end
- end
Add Comment
Please, Sign In to add comment