Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args={...}
- local function gForward()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- local function gUp()
- --print("GoingUp!")
- while not turtle.up() do
- turtle.digUp()
- end
- end
- local function digRow(length)
- for i=2,length do
- gForward()
- end
- end
- local function dig2Row(length)
- turtle.digUp()
- for i=2,length do
- gForward()
- turtle.digUp()
- end
- end
- local function placeChest()
- turtle.select(1)
- print("Placing the goods!")
- while not turtle.place() do
- turtle.dig()
- end
- for i=2,18 do
- turtle.select(i)
- turtle.drop()
- end
- local function digPlane(length,height)
- local remainingHeight = height
- local firstPass = true
- while remainingHeight > 0 do
- if not firstPass then
- gUp()
- else firstPass = false
- end
- if remainingHeight > 1 then
- dig2Row(length)
- gUp()
- remainingHeight = remainingHeight - 2
- else
- digRow(length)
- remainingHeight = remainingHeight - 1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- for i = 2,height do
- turtle.down()
- end
- if ((remainingHeight + 1) /2 ) % 2 == 1 then
- digRow(length)
- turtle.turnLeft()
- turtle.turnLeft()
- end
- placeChest()
- end
- local glength = tonumber(args[1])
- local gheight = tonumber(args[2])
- local gwidth = tonumber(args[3])
- for j = 1, gwidth do
- print("Starting Plane "..j)
- digPlane(glength,gheight)
- if not (j == gwidth) then
- turtle.turnLeft()
- gForward()
- turtle.turnRight()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement