Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xx = 1
- local yy = 1
- local zz = 1
- local face = ""
- io.write("x, y, z, face (form: '+x' or '-y') Hit enter after each variable")
- xx = tonumber(io.read())
- yy = tonumber(io.read())
- zz = tonumber(io.read())
- face = tostring(io.read())
- function twobytwo(x, y)
- goTo(x, y, 50)
- turn("+x")
- shaft("down")
- forwardOne()
- xx = xx + 1
- turtle.turnRight()
- forwardOne()
- yy = yy - 1
- turtle.turnRight()
- shaft("up")
- end
- function turn(dir)
- function r()
- turtle.turnRight()
- end
- function l()
- turtle.turnLeft()
- end
- if (face == "-x") then
- if (dir == "-x") then
- end
- if (dir == "+x") then
- r()
- r()
- end
- if (dir == "-y") then
- l()
- end
- if (dir == "+y") then
- r()
- end
- end
- if (face == "+x") then
- if (dir == "-x") then
- r()
- r()
- end
- if (dir == "+x") then
- end
- if (dir == "-y") then
- r()
- end
- if (dir == "+y") then
- l()
- end
- end
- if (face == "-y") then
- if (dir == "-x") then
- r()
- end
- if (dir == "+x") then
- l()
- end
- if (dir == "-y") then
- end
- if (dir == "+y") then
- r()
- r()
- end
- end
- if (face == "+y") then
- if (dir == "-x") then
- l()
- end
- if (dir == "+x") then
- r()
- end
- if (dir == "-y") then
- r()
- r()
- end
- if (dir == "+y") then
- end
- end
- face = dir
- end
- function goTo(x, y, z)
- if (zz >= 50) then
- local h = zz
- for i = 1, (h - 50) do
- turtle.digDown()
- turtle.down()
- zz = zz -1
- end
- end
- if (zz < 50) then
- local h = zz
- for i = 1, (50 - h) do
- oneUp()
- end
- end
- if(xx >= x) then
- turn("-x")
- for i = 1, (xx - x) do
- forwardOne()
- xx = xx - 1
- end
- end
- if(xx < x) then
- turn("+x")
- for i = 1, (x - xx) do
- forwardOne()
- xx = xx + 1
- end
- end
- if(yy >= y) then
- turn("-y")
- for i = 1, (yy - y) do
- forwardOne()
- yy = yy -1
- end
- face = "-y"
- end
- if(yy < y) then
- turn("+y")
- for i = 1, (y - yy) do
- forwardOne()
- yy = yy + 1
- end
- face = "+y"
- end
- if (z < 50) then
- for i = 1, (50 - z) do
- oneUp()
- end
- end
- if (z > 50) then
- for i = 0, (z - 50) do
- turtle.digDown()
- turtle.down()
- zz = zz - 1
- end
- end
- end
- function shaft(direction)
- if (direction == "down") then
- local h = zz
- for i = 1, h do
- turtle.digDown()
- turtle.down()
- zz = zz - 1
- if (turtle.compare() == false) then
- turtle.dig()
- end
- end
- end
- if (direction == "up") then
- local h = zz
- for i = 1, h do
- oneUp()
- if (turtle.compare() == false) then
- turtle.dig()
- end
- end
- end
- end
- function forwardOne()
- local test = turtle.forward()
- while (test == false) do
- turtle.dig()
- test = turtle.forward()
- end
- end
- function oneUp()
- local test = turtle.up()
- while (test == false) do
- turtle.digUp()
- test = turtle.up()
- end
- zz = zz + 1
- end
- twobytwo(xx, yy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement