Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setup()
- X = 1
- Y = 1
- Z = 1
- Blueprint = {}
- xsize = 10
- ysize = 20
- zsize = 5
- for xset = 1, xsize do
- Blueprint[xset] = {}
- for yset = 1, ysize do
- Blueprint[xset][yset] = {}
- for zset = 1, zsize do
- Blueprint[xset][yset][zset] = {}
- end
- end
- end
- end
- function moveto(newx, newy, newz)
- move_x = newx - X
- move_y = newy - Y
- move_z = newz - Z
- X = X + move_x
- Y = Y + move_y
- Z = Z + move_z
- if move_x > 0 then
- for move = 1, move_x do
- turtle.forward()
- end
- elseif move_x < 0 then
- move_x = - move_x
- for move = 1, move_x do
- turtle.back()
- end
- end
- if move_y > 0 then
- turtle.turnLeft()
- for move = 1, move_y do
- turtle.forward()
- end
- turtle.turnRight()
- elseif move_y < 0 then
- move_y = - move_y
- turtle.turnLeft()
- for move = 1, move_y do
- turtle.back()
- end
- turtle.turnRight()
- end
- if move_z > 0 then
- for move = 1, move_z do
- turtle.up()
- end
- elseif move_z < 0 then
- move_z = - move_z
- for move = 1, move_z do
- turtle.down()
- end
- end
- end
- function moveby(newx, newy, newz)
- move_x = newx
- move_y = newy
- move_z = newz
- X = X + move_x
- Y = Y + move_y
- Z = Z + move_z
- if move_x > 0 then
- for move = 1, move_x do
- turtle.forward()
- end
- elseif move_x < 0 then
- move_x = - move_x
- for move = 1, move_x do
- turtle.back()
- end
- end
- if move_y > 0 then
- turtle.turnLeft()
- for move = 1, move_y do
- turtle.forward()
- end
- turtle.turnRight()
- elseif move_y < 0 then
- move_y = - move_y
- turtle.turnLeft()
- for move = 1, move_y do
- turtle.back()
- end
- turtle.turnRight()
- end
- if move_z > 0 then
- for move = 1, move_z do
- turtle.up()
- end
- elseif move_z < 0 then
- move_z = - move_z
- for move = 1, move_z do
- turtle.down()
- end
- end
- end
- function refill()
- for s = 2, 16 do
- if turtle.getItemSpace() == 64 then
- turtle.select(s)
- turtle.transferTo(1)
- end
- end
- turtle.select(1)
- end
- function make()
- turtle.up()
- for z = 1, zsize do
- for y = 1, ysize do
- for x = 1, xsize do
- if Blueprint[x][y][z] == 1 then
- turtle.placeDown()
- refill()
- end
- turtle.forward()
- end
- for x = 1, xsize do
- turtle.back()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- turtle.turnLeft()
- for y = 1, ysize do
- turtle.back()
- end
- turtle.turnRight()
- turtle.up()
- end
- end
- function set()
- for xset = 1, 10 do
- for yset = 1, 20 do
- for zset = 1, 2 do
- Blueprint[xset][yset][zset] = 1
- end
- end
- end
- for xset = 2, 9 do
- for yset = 1, 20 do
- for zset = 1, 2 do
- Blueprint[xset][yset][zset] = 0
- end
- end
- end
- for xset = 2, 9 do
- for yset = 1, 20 do
- Blueprint[xset][yset][3] = 1
- end
- end
- for xset = 3, 8 do
- for yset = 1, 20 do
- Blueprint[xset][yset][3] = 0
- end
- end
- for xset = 3, 8 do
- for yset = 1, 20 do
- Blueprint[xset][yset][4] = 1
- end
- end
- for xset = 4, 7 do
- for yset = 1, 20 do
- Blueprint[xset][yset][4] = 0
- end
- end
- for xset = 4, 7 do
- for yset = 1, 20 do
- Blueprint[xset][yset][5] = 1
- end
- end
- end
- setup()
- -- set()
- -- make()
- moveto(5, 5, 5)
- moveby(10, 0, 0)
- print("X:"..X.."Y:"..Y.."Z:"..Z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement