Notze

Strip v2.1

Aug 22nd, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.68 KB | None | 0 0
  1. --[[
  2. Version 2.1
  3. Written by: Tom Nordloh (Notze)
  4.  
  5. This script will do the Stripmining
  6. for you. Amount and length of the
  7. branches are adjustable just as the
  8. spacing between them also is.
  9. Place the following things into the
  10. Turtles inventory:
  11. Slot 1: cole
  12. Slot 2: torch
  13. Slot 3: filling material
  14. ]]
  15.  
  16. -- make your adjustments here
  17. local int branches = 5          -- the amount of "branch-pairs"
  18. local int branchLength = 32     -- the length of each branch
  19. local int branchSpace = 5       -- the space between each branch-pair
  20.  -- end of adjustments
  21.  
  22.  function main()
  23.      for i=1, branches, 1 do
  24.             refuel(1+(branchSpace+branchLength*4)/96)
  25.             forward(branchSpace+1)
  26.             turnLeft()
  27.             forward(branchLength)
  28.             back(branchLength)
  29.             torch()
  30.             turnAround()
  31.             forward(branchLength)
  32.             back(branchLength)
  33.             torch()
  34.             turnLeft()
  35.     end
  36.  end
  37.  
  38. function refuel(amount)
  39.         if turtle.getFuelLevel() < 96*amount then
  40.                 turtle.select(1)
  41.                 turtle.refuel(amount)
  42.         end
  43. end
  44.  
  45. function forward(length)
  46.         for i=1, length, 1 do
  47.                 while turtle.detect() or turtle.detectUp() do
  48.                         turtle.dig()
  49.                         turtle.digUp()
  50.                         sleep(0.5)
  51.                 end
  52.                 if turtle.detectDown() == false then
  53.                         turtle.select(3)
  54.                         turtle.placeDown()
  55.                 end
  56.                 turtle.forward()
  57.         end
  58. end
  59.  
  60. function back(length)
  61.         for i=1, length, 1 do
  62.                 if i==9 then torch() end
  63.                 if (i-8)%16==0 and i>9 then torch() end
  64.                 turtle.back()
  65.         end
  66. end
  67.  
  68. function turnLeft()
  69.         turtle.turnLeft()
  70. end
  71.  
  72. function turnRight()
  73.         turtle.turnRight()
  74. end
  75.  
  76. function turnAround()
  77.         turtle.turnRight()
  78.         turtle.turnRight()
  79. end
  80.  
  81. function torch()
  82.         turtle.select(2)
  83.         turtle.place()
  84. end
  85.  
  86. main()
Advertisement
Add Comment
Please, Sign In to add comment