Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local x,y = nil
  2.  
  3. local args = {...}
  4.  
  5. x = toNumber(args[0])
  6. y = toNumber(args[1])
  7.  
  8. print("Doing a " ..x .." by "  ..y)
  9.  
  10. function calcFuel()
  11.     local fuel = (x*y)+y
  12.     local hasFuel = false
  13.     while not hasFuel do
  14.         if turtle.getFuelLevel() < fuel then
  15.             print("Fuel is to low to do that! Please give me more Fuel!")
  16.             print("Insert Fuel and wait 5 secs!")
  17.             sleep(5)
  18.             local i
  19.             for i = 1, 16 do
  20.                 turtle.select(i)
  21.                 turtle.refuel()
  22.                 i=i+1
  23.             end
  24.             turtle.select(1)
  25.         else
  26.             print("Got enough fuel for that!")
  27.             turtle.select(1)
  28.         end
  29.     end
  30. end
  31.  
  32. function tryForward()
  33.   while not turtle.forward() do
  34.     turtle.dig()
  35.   end
  36. end
  37.  
  38. function goPlace()
  39.   turtle.placeDown()
  40.   tryForward()
  41. end
  42.  
  43. function collum()
  44.   local i = 0
  45.   while i<x do
  46.     goPlace()
  47.     i=i+1
  48.   end
  49. end
  50.  
  51. function rows()
  52.   local j = 1
  53.   local turn = false
  54.   while j < y do
  55.     collum()
  56.     if turn then
  57.       turtle.turnLeft()
  58.       tryForward()
  59.       turtle.turtle.turnLeft()
  60.     else
  61.       turtle.turnRight()
  62.       tryForward()
  63.       turtle.turnRight()
  64.     end
  65.     j=j+1
  66.   end
  67. end
  68.  
  69. calcFuel()
  70. turtle.turnLeft()
  71. rows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement