truh

adt_1.3

Oct 24th, 2012
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Advanced Turtle API
  2. --@author truh
  3.  
  4. function hungry()
  5.   return true
  6. end
  7.  
  8. function eat(n)
  9.   return true
  10. end
  11.  
  12. function autoEat()
  13.   return true
  14. end
  15.  
  16. function forward(n)
  17.   if n==nil then
  18.     n=1
  19.   end
  20.   for i=1, n do
  21.     while not turtle.forward() do end
  22.   end
  23. end
  24.        
  25. function back(n)
  26.   if n==nil then
  27.     n=1
  28.   end
  29.   for i=1, n do
  30.     while not turtle.back() do end
  31.   end  
  32. end
  33.  
  34. function up(n)
  35.   if n==nil then
  36.     n=1
  37.   end
  38.   for i=1, n do
  39.     while not turtle.up() do end
  40.   end  
  41. end
  42.  
  43. function down(n)
  44.   if n==nil then
  45.     n=1
  46.   end
  47.   for i=1, n do
  48.     while not turtle.down() do end
  49.   end  
  50. end
  51.        
  52. function turnLeft(n)
  53.   if n==nil then
  54.     n=1
  55.   end
  56.   for i=1, n do
  57.     turtle.turnLeft()
  58.   end    
  59. end
  60.        
  61. function turnRight(n)
  62.   if n==nil then
  63.     n=1
  64.   end
  65.   for i=1, n do
  66.     turtle.turnRight()
  67.   end    
  68. end
  69.  
  70. function place()
  71.   for i=1, 16 do
  72.     turtle.select(i)
  73.     if turtle.place() then
  74.       break
  75.     end
  76.   end
  77. end
  78.  
  79. function placeUp()
  80.   for i=1, 16 do
  81.     turtle.select(i)
  82.     if turtle.placeUp() then
  83.       break
  84.     end
  85.   end
  86. end
  87.  
  88. function placeDown()
  89.   for i=1, 16 do
  90.     turtle.select(i)
  91.     if turtle.placeDown() then
  92.       break
  93.     end
  94.   end
  95. end
  96.  
  97. function inventorySpace()
  98.   space=0
  99.   for i=1, 16 do
  100.     space=space+turtle.getItemSpace(i)
  101.   end
  102.   return space
  103. end
Advertisement
Add Comment
Please, Sign In to add comment