le_Fish

oldStripmine

Apr 19th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. print("insert alot of torches in slot 1 or 2")
  2. term.write("Insert Length: ")
  3. Length = tonumber(read())
  4. print(" ")
  5.  
  6. local Length = Length
  7. local my_length = 0
  8.  
  9. local total_width = 0
  10. local done = false
  11.  
  12. function stripMine()
  13.     turtle.turnRight()
  14.     repeat
  15.         go_forward()
  16.         total_width = total_width + 1
  17.     until total_width == 6
  18.     repeat
  19.         turtle.digUp()
  20.     until turtle.up() == true
  21.     turtle.down()
  22.     turtle.digDown()
  23.  
  24.     turtle.turnLeft()
  25.     turtle.turnLeft()
  26.  
  27.     repeat
  28.         turtle.forward()
  29.         total_width = total_width - 1
  30.     until total_width == 0
  31.  
  32.     repeat
  33.         go_forward()
  34.         total_width = total_width + 1
  35.     until total_width == 6
  36.     repeat
  37.         turtle.digUp()
  38.     until turtle.up() == true
  39.     turtle.down()
  40.     turtle.digDown()
  41.  
  42.     turtle.turnLeft()
  43.     turtle.turnLeft()
  44.  
  45.     repeat
  46.         turtle.forward()
  47.         total_width = total_width - 1
  48.     until total_width == 0
  49.  
  50.     turtle.turnLeft()
  51. end
  52.  
  53. function go_forward()
  54.     repeat
  55.         turtle.dig()
  56.     until not turtle.detect() == true
  57.     turtle.forward()
  58.     repeat
  59.         turtle.digUp()
  60.     until turtle.up() == true
  61.     turtle.down()
  62.     turtle.digDown()
  63. end
  64.  
  65. print("start")
  66. repeat
  67.     if  (my_length + 3) < Length then
  68.         print(my_length)
  69.         go_forward()
  70.         go_forward()
  71.         go_forward()
  72.         local item_detail = turtle.getItemDetail(1)
  73.         if string.find(item_detail.name, "torch") ~= nil then
  74.             turtle.select(1)
  75.             turtle.placeDown()
  76.         else
  77.             local item_detail = turtle.getItemDetail(2)
  78.             if string.find(item_detail.name, "torch") ~= nil then
  79.                 turtle.select(2)
  80.                 turtle.placeDown()
  81.             end
  82.         end
  83.         my_length = my_length + 3
  84.         stripMine()
  85.     else
  86.         turtle.turnLeft()
  87.         turtle.turnLeft()
  88.         repeat
  89.             turtle.forward()
  90.             my_length = my_length - 1
  91.         until my_length == 0
  92.         done = true
  93.     end
  94. until done == true
Add Comment
Please, Sign In to add comment