Advertisement
GauHelldragon

GauFloor v0.1

Mar 7th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1.  
  2. local selection = 1
  3. turtle.select(selection)
  4.  
  5.  
  6. function tryForward()
  7.   if ( turtle.forward() == false ) then
  8.     print("Get out of my way!!")
  9.     while ( turtle.forward() == false ) do
  10.       os.sleep(2)  
  11.     end
  12.   end
  13. end
  14.  
  15.  
  16. function selectBlock()
  17.   if ( selection == 16 ) then return end
  18.  
  19.   while ( turtle.getItemCount(selection) <= 0 ) do
  20.     if ( selection == 16 ) then return end
  21.     selection = selection + 1      
  22.     turtle.select(selection)
  23.   end
  24. end
  25.  
  26.  
  27. function DropBlock()
  28.   selectBlock()
  29.   turtle.placeDown()
  30. end  
  31.  
  32. local left,right = 1,2
  33.  
  34. local turn = left
  35.  
  36.  
  37. function doTurn()
  38.   if ( turn == left ) then
  39.     turtle.turnLeft()
  40.   else
  41.     turtle.turnRight()
  42.   end
  43. end
  44.  
  45. function switchTurn()
  46.   if ( turn == left ) then
  47.     turn = right
  48.   else
  49.     turn = left
  50.   end
  51. end
  52.  
  53. if ( turtle.detectDown() ) then turtle.forward() end
  54.  
  55.  
  56. while ( turtle.detectDown() == false ) do
  57.   -- do a row
  58.   while ( turtle.detectDown() == false ) do
  59.     DropBlock()
  60.     tryForward()
  61.   end
  62.   doTurn()
  63.   turtle.forward()
  64.   doTurn()
  65.   turtle.forward()
  66.   switchTurn()
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement