largeNumberGoeshere

justbreak.lua

Apr 19th, 2021 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. --- Breaks blocks in front of turtle
  2.  
  3. -- S= start , e=end
  4. --Dig message screem pos. S=start, e=end
  5.  
  6. local checkFullInterval = 10
  7. local checkFullI = 1
  8.  
  9. local digC = {start= {x=1,y=1}, ends={x=1,y=1}}
  10. local pushDirection = "back"
  11.  
  12.  
  13. function resetCursor()
  14.     term.setCursorPos(digC.start.y,digC.ends.y)
  15. end
  16.  
  17. slotsFull = 0
  18. function turtle.attemptPush()    
  19.     if checkFullI == checkFullInterval then
  20.     checkFullI = 1
  21.     slotsFull = 0
  22.     for i=1, 16 do
  23.         turtle.select(i)
  24.         if turtle.getItemCount() > 0 then
  25.             slotsFull = slotsFull + 1
  26.         end    
  27.     end
  28.     turtle.select(1)    
  29.     else
  30.     end
  31.     checkFullI = checkFullI+1
  32.    
  33.     if slotsFull > 15 then
  34.         return false
  35.     else
  36.         return true
  37.     end
  38. end
  39.  
  40.  
  41. function turtle.attemptDig()
  42.     if turtle.detect() then
  43.         turtle.dig()
  44.         return true
  45.     else
  46.         return false
  47.     end
  48. end
  49.  
  50. function term.clearLines(firstLine,lastLine)
  51.     for i=firstLine,lastLine do
  52.         term.clearLine(i)
  53.     end
  54. end
  55.  
  56. while true do
  57.     while not turtle.attemptDig() do
  58.         resetCursor()
  59.        
  60.         print("nothing to dig")
  61.         print("time: "..tostring(os.time()))
  62.         --resetCursor()
  63.         --sleep(0.1)
  64.     end
  65.     term.clear()
  66.         --term.clearLines(digC.start.y,digC.ends.y+1 )
  67.         --resetCursor()
  68.    while not turtle.attemptPush() do
  69.        print("not enough room")
  70.    end
  71.      
  72. end
  73.  
Add Comment
Please, Sign In to add comment