Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function checkFuel( )
- write("Checking fuel level...")
- if turtle.getFuelLevel() < 20 then
- print("need refuel.")
- for i=1,16 do
- turtle.select(i)
- if turtle.refuel(turtle.getItemCount(i)) then
- write("Fueled from slot ")
- print(i)
- end
- if turtle.getFuelLevel() >= 500 then
- return
- end
- end
- else
- print("fuel status is ok.")
- end
- end
- local function goToGround( )
- write("goToGround...")
- while turtle.detectDown() == false do
- turtle.down()
- end
- print("ok")
- end
- local function makeCorridoor( length )
- goToGround()
- write("makeCorridoor")
- for i=0,length do
- write(".");
- turtle.dig()
- turtle.down()
- turtle.dig()
- turtle.up()
- turtle.forward()
- end
- print("done")
- end
- local function makeCorridoorReturn( length )
- makeCorridoor(length)
- for i=0,length do
- turtle.back()
- end
- end
- local function makeMatrix( rows, cols )
- local coord, size
- coord = {}
- size = {}
- coord.x = 0
- coord.y = 0
- size.x = 2 * rows + 1
- size.y = 2 * cols + 1
- print("Cols...")
- for i=1,cols,1 do
- checkFuel()
- write("i=")
- print(i)
- makeCorridoorReturn( size.x )
- turtle.turnRight()
- makeCorridoor(3)
- turtle.turnLeft()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=0,size.y,1 do
- turtle.forward()
- end
- turtle.turnRight()
- print("Rows...")
- for i=1,rows,1 do
- checkFuel()
- write("i=")
- print(i)
- makeCorridoorReturn( size.y )
- turtle.turnLeft()
- makeCorridoor(3)
- turtle.turnRight()
- end
- end
- makeMatrix( 6, 6 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement