Notze

Strip v2.2

Nov 23rd, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. --[[
  2. Version 2.2
  3. Written by: Tom Nordloh (Notze)
  4.  
  5. This script will do the Stripmining
  6. for you. Amount, length, spacing of
  7. thebranches and some other stuff are
  8. adjustable.
  9. If you don't make adjustments just
  10. place the following things into the
  11. Turtles inventory:
  12. Slot 1: fuel (e.g. Coal)
  13. Slot 2: torches
  14. Slot 3: filling material
  15. ]]
  16.  
  17. -- MAKE YOUR ADJUSTMENTS HERE
  18. branch = {amount = 5,   -- the amount of "branch-pairs"
  19.       length = 32,  -- the length of each branch
  20.       space  = 5}   -- the space between each branch-pair
  21. slot = {fuel  = 1,  -- the slotnumber for fuel
  22.     torch = 2,  -- the slotnumber for torches
  23.     fill  = 3}  -- the slotnumber for filling material
  24. other = {torch = true,  -- place torches? (true=yes/false=no)
  25.          close = true}  -- close the branches? (true=yes/false=no)
  26. -- END OF ADJUSTMENTS
  27.  
  28. function main()
  29.  for i=1, branch.amount, 1 do
  30.   refuel(1+(branch.space+branch.length*4)/96)
  31.   forward(1)
  32.   turnAround()
  33.   torch()
  34.   turnAround()
  35.   forward(branch.space)
  36.   turnLeft()
  37.   forward(branch.length)
  38.   back(branch.length)
  39.   turnAround()
  40.   forward(branch.length)
  41.   back(branch.length)
  42.   turnLeft()
  43.  end
  44. end
  45.  
  46. function forward(length)
  47.  for i=1, length, 1 do
  48.   while turtle.detect() or turtle.detectUp() do
  49.    turtle.dig()
  50.    turtle.digUp()
  51.    sleep(0.5)
  52.   end
  53.   if turtle.detectDown() == false then
  54.    turtle.select(slot.fill)
  55.    turtle.placeDown()
  56.   end
  57.   turtle.forward()
  58.  end
  59. end
  60.  
  61. -- TurtleAPI
  62.  
  63. function refuel(amount)
  64.  if turtle.getFuelLevel() == "unlimited" then return end
  65.  if turtle.getFuelLevel() < 96*amount then
  66.   turtle.select(slot.fuel)
  67.   turtle.refuel(amount)
  68.  end
  69. end
  70.  
  71. function back(length)
  72.  for i=1, length, 1 do
  73.   if i==9 then torch() end --places a torch after the first 8 blocks and
  74.   if (i-8)%16==0 and i>9 then torch() end --then another every 16 blocks
  75.   turtle.back()
  76.   if i==length-1 and other.close then --closes the branch
  77.    turtle.select(slot.fill)
  78.    turtle.placeUp()
  79.   end
  80.  end
  81. end
  82.  
  83. function turnLeft()
  84.  turtle.turnLeft()
  85. end
  86.  
  87. function turnRight()
  88.  turtle.turnRight()
  89. end
  90.  
  91. function turnAround()
  92.  turtle.turnRight()
  93.  turtle.turnRight()
  94. end
  95.  
  96. function torch()
  97.  if other.torch then
  98.   turtle.select(slot.torch)
  99.   turtle.place()
  100.  end
  101. end
  102.  
  103. main()
Advertisement
Add Comment
Please, Sign In to add comment