MiStAWaFFlEZZ

PinwheelMinev1

Dec 9th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. function shaft()
  2. --variables
  3. shaftdepth = 0
  4. shaft_branch_count = 0
  5.  
  6. term.clear()
  7. repeat
  8.     turtle.dig()
  9.     if turtle.forward() then
  10.         shaftdepth = shaftdepth + 1
  11.         shaft_branch_count = shaft_branch_count + 1
  12.         --percentage()
  13.         turtle.digUp()
  14.     else
  15.         print("Movement Impeded!")
  16.         turtle.dig()
  17.     end
  18.     if shaft_branch_count == 3 then
  19.         turtle.turnLeft()
  20.         branch()
  21.     end
  22. until shaftdepth == des_depth
  23. shaft_return()
  24. end
  25.  
  26. function branch()
  27.     branchdepth = 0
  28.     repeat
  29.         turtle.dig()
  30.         if turtle.forward() then
  31.             branchdepth = branchdepth +1
  32.             turtle.digUp()
  33.         else
  34.             print("Movement Impeded!")
  35.             turtle.dig()
  36.         end
  37.     until branchdepth == des_branch_depth
  38.     turtle.turnLeft()
  39.     turtle.turnLeft()
  40.     repeat
  41.         if turtle.forward() then
  42.             des_branch_depth = des_branch_depth - 1
  43.         else
  44.             print("Movement Impeded!")
  45.             turtle.dig()
  46.             sleep(0.5)
  47.         end
  48.     until des_branch_depth == 0
  49.     turtle.turnLeft()
  50. end
  51.  
  52. function shaft_return()
  53. end
  54.  
  55. function dorotate()
  56. end
  57.  
  58. function percentage()
  59. percent = tonumber(shaftdepth) / tonumber(des_depth) * 100
  60. percentage = math.ceil(percent)
  61. print("Completed " ..percentage.. "%")
  62. end
  63.  
  64. print("Pinwheel Mining System V. 0.2B")
  65. sleep (1)
  66. print("Place in a 3x3 room at desired height")
  67. sleep(1)
  68. print("Ready? [y/n]")
  69. sleep(0.5)
  70. local confirm = read()
  71. if confirm == "y" then
  72. term.clear()
  73. sleep(1)
  74. print("Desired Shaft Length:")
  75. sleep(0.5)
  76. des_depth = read()
  77. print("Branch Depth = Shaft Length + 2")
  78. des_branch_depth = des_depth + 2
  79. term.clear()
  80. sleep(1)
  81. --print("Desired Branch Length:")
  82. --sleep(0.5)
  83. --des_branch_depth = read()
  84. shaft()
  85. else
  86.     os.shutdown()
  87. end
Advertisement
Add Comment
Please, Sign In to add comment