Advertisement
shirkit

Teto

Mar 31st, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local tArgs = {...}
  2. local length = tonumber(tArgs[1]) or 0
  3. local width = tonumber(tArgs[2]) or 0
  4.  
  5. local slot = 1
  6.  
  7. function doWork()
  8.     for i = 1, width, 1 do
  9.         for j = 1, length, 1 do
  10.             turtle.digUp()
  11.             place("up")
  12.            
  13.             if j < length then
  14.                 turtle.forward()
  15.             end
  16.         end
  17.        
  18.         if ( i % 2 == 0 ) then
  19.             turtle.turnRight()
  20.         else
  21.             turtle.turnLeft()
  22.         end
  23.         turtle.forward()
  24.         if ( i % 2 == 0 ) then
  25.             turtle.turnRight()
  26.         else
  27.             turtle.turnLeft()
  28.         end
  29.     end
  30. end
  31.  
  32. function place(dir)
  33.     if turtle.getItemCount(slot) == 1 then
  34.         if slot == 16 then
  35.             print("Put more blocks")
  36.             while turtle.getItemCount(slot) == 1 do
  37.                 sleep(1)
  38.             end
  39.             slot = 1
  40.         else
  41.             slot = slot + 1
  42.         end
  43.         turtle.select(slot)
  44.         place(dir)
  45.     end
  46.    
  47.     if dir == "up" then
  48.         turtle.placeUp()
  49.     elseif dir == "down" then
  50.         turtle.placeDown()
  51.     else
  52.         turtle.place()
  53.     end
  54.  
  55. end
  56. doWork()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement