Advertisement
DustinRosebery

waller2.0

Oct 26th, 2014
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. local t = turtle
  2.  
  3. local function reSupply()
  4.     t.select(15)
  5.     t.turnLeft()
  6.     t.dig()
  7.     t.place()
  8.  
  9.     for i = 9, 14, 1 do
  10.         t.select(i)
  11.         t.suck()
  12.     end
  13.  
  14.     t.select(15)
  15.     t.dig()
  16.     t.turnRight()
  17. end
  18.  
  19.  
  20. local function clearInventory()
  21.  
  22.         t.select(16)  
  23.         t.turnRight()  
  24.         t.dig()
  25.         t.place()
  26.        
  27.         for i = 1, 15, 1 do       -- selects all slots and places in chest
  28.                 t.select(i)
  29.                 t.drop()
  30.     end
  31.  
  32.         t.select(16)
  33.         t.dig()
  34.         t.turnLeft()
  35. end
  36.  
  37. local function matCheck()
  38.  
  39.     for i = 9, 14, 1 do
  40.        
  41.         itemCount = t.getItemCount(i)
  42.         t.select(i)
  43.         if itemCount > 0 then
  44.  
  45.         break end
  46.  
  47.         if t.getItemCount(14) == 0 then
  48.         reSupply()
  49.         end
  50.     end
  51. end
  52.  
  53. local function goingUp()
  54.  
  55.     blockAbove = false 
  56.  
  57.     repeat
  58.  
  59.     itemCount = t.getItemCount(8)    
  60.         if itemCount > 0 then
  61.             clearInventory()
  62.     end
  63.  
  64.     matCheck() 
  65.     t.dig()
  66.     t.place()
  67.     t.up()
  68.    
  69.     if t.detectUp() then
  70.         blockAbove = true
  71.     end
  72.    
  73.     until blockAbove == true
  74. end
  75.    
  76. local function topDown()
  77.    
  78.     itemCount = t.getItemCount(16)
  79.         if itemCount > 0 then
  80.             clearInventory()
  81.     end
  82.  
  83.     matCheck()
  84.     t.dig()
  85.     t.place()
  86.     t.turnRight()
  87.     t.forward()
  88.     t.turnLeft()
  89. end
  90.  
  91. local function goingDown()
  92.    
  93.     blockBelow = false
  94.  
  95.     repeat
  96.    
  97.     itemCount = t.getItemCount(8)
  98.     if itemCount > 0 then
  99.             clearInventory()
  100.     end
  101.  
  102.     matCheck()
  103.     t.dig()
  104.     t.place()
  105.     t.down()
  106.  
  107.     if t.detectDown() then
  108.         blockBelow = true
  109.     end
  110.  
  111.     until blockBelow == true
  112. end
  113.    
  114. local function bottomUp()
  115.  
  116.     itemCount = t.getItemCount(8)
  117.         if itemCount > 0 then
  118.             clearInventory()
  119.     end
  120.  
  121.     matCheck()
  122.     t.dig()
  123.     t.place()
  124.     t.turnRight()
  125.     t.forward()
  126.     t.turnLeft()
  127. end
  128.    
  129. local function keepGoing()
  130.    
  131.     t.turnRight()
  132.     flag = false
  133.    
  134.     if t.detect() then
  135.     flag = true
  136.     end
  137.    
  138.     t.turnLeft()
  139.     return flag
  140. end
  141.  
  142. local function wallDown()
  143.     for i = 0, 63, 1 do
  144.         t.dig()
  145.         t.forward()
  146.        
  147.         for j = 0, 64, 1
  148.             t.digDown()
  149.             t.down()
  150.            
  151.         end
  152.         clearInventory()
  153.        
  154.         t.dig()
  155.         t.forward()
  156.         for j = 0, 64, 1 do
  157.             t.digUp()
  158.             t.up()
  159.         end
  160.         clearInventory()
  161.     end
  162. end
  163.  
  164. wallDown() 
  165. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement