Advertisement
kreezxil

buildcraft quarry setup

Nov 3rd, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.58 KB | None | 0 0
  1. -- By Plazter modified by Kreezxil
  2. -- Original: https://pastebin.com/Sb8VwgwU
  3. -- By Kreezxil: https://pastebin.com/KMmf89b5
  4. -- - I added a waitForEnter() function, instead of using the stupid sleep()
  5.  
  6. local block = 1
  7. local quarry = 13
  8. local tesseract = 16
  9. local landmark = 15
  10. local chest = 14
  11. local length = 10
  12. local height = 0
  13.  
  14. function height()
  15.     term.clear()
  16.     term.setCursorPos(1,1)
  17.     print("Do you wish the turtle to setup the quarry in air?")
  18.     print("Press Y/N to confirm")
  19.     local event, key = os.pullEvent("key")
  20.     if key == keys.y then
  21.         print("How far up?")
  22.         input = read()
  23.         if input then
  24.             height = tonumber(input)
  25.         end
  26.     end
  27. end
  28.  
  29. function waitForEnter()
  30.     while true do
  31.         local event, key = os.pullEvent("key")
  32.         if key == keys.enter then
  33.             return key
  34.         end
  35.     end
  36. end
  37.  
  38. function checkFuel()
  39.     term.clear()
  40.     term.setCursorPos(1,1)
  41.     print("Checking if i have enough fuel..")
  42.     sleep(2)
  43.  
  44.     if turtle.getFuelLevel() >= 500 then
  45.         print("Im fine on fuel thanks.. press enter to continue.")
  46.         waitForEnter()
  47.     elseif turtle.getFuelLevel() < 500 then
  48.         print("Please give me fuel master!")
  49.         key = waitForEnter()
  50.         if key == keys.enter then
  51.             turtle.refuel()
  52.         end
  53.  
  54.     end
  55. end
  56.  
  57.  
  58. function lenght()
  59.     term.clear()
  60.     term.setCursorPos(1,1)
  61.     print("How big do you want the quarry?")
  62.     input = read()
  63.     if input then
  64.         length = input
  65.     elseif input == nil then
  66.         print("Error..")
  67.     end
  68.  
  69.     print("You have said that you want the quarry to be: ".. tostring(length))
  70.     print("Are you sure?")
  71.     print("Press Y/N")
  72.  
  73.     while true do
  74.         local event, key = os.pullEvent("key")
  75.         if key == keys.y then
  76.             print("I'm gonna go a head and build you quarry!")
  77.             sleep(2)
  78.             Quarry()
  79.         end
  80.         if key == keys.n then
  81.             print("You pressed N, breaking the program..")
  82.             break
  83.         end
  84.     end
  85. end
  86.  
  87. function Quarry()
  88.     for i = 0, height do
  89.         turtle.up()
  90.     end
  91.  
  92.     -- [ Landmarks ] --
  93.     for i = 1,length do
  94.         turtle.forward()
  95.     end
  96.     turtle.select(block)
  97.     turtle.forward()
  98.     turtle.placeDown()
  99.     turtle.back()
  100.  
  101.     turtle.select(landmark)
  102.     turtle.place()
  103.  
  104.     for o = 1, length -1  do
  105.         turtle.back()
  106.     end
  107.  
  108.     turtle.turnRight()
  109.  
  110.     for p = 1,length do
  111.         turtle.forward()
  112.     end
  113.  
  114.     turtle.select(block)
  115.     turtle.forward()
  116.     turtle.placeDown()
  117.     turtle.back()
  118.     turtle.select(landmark)
  119.     turtle.place()
  120.  
  121.     for a = 1, length do
  122.         turtle.back()
  123.     end
  124.  
  125.     turtle.turnLeft()
  126.     turtle.select(block)
  127.     turtle.placeDown()
  128.     turtle.back()
  129.     turtle.select(landmark)
  130.     turtle.place()
  131.     turtle.attack()
  132.     -- [ Landmarks end] --
  133.     turtle.back()
  134.     turtle.select(quarry)
  135.     turtle.place()
  136.     turtle.up()
  137.     turtle.select(chest)
  138.     turtle.place()
  139.     turtle.back()
  140.     turtle.down()
  141.     turtle.select(tesseract)
  142.     turtle.place()
  143.     print("Done.")
  144.     for i = 0, height do
  145.         turtle.down()
  146.     end
  147. end
  148.  
  149. function itemsSlot()
  150.     term.clear()
  151.     term.setCursorPos(1,1)
  152.     print("Place following items in slot:")
  153.     print("Block for air placement: 1")
  154.     print("Quarry: 13")
  155.     print("Chest: 14")
  156.     print("Landmarks: 15")
  157.     print("Tesseract: 16")
  158.     print("Press enter when ready")
  159.     waitForEnter()
  160. end
  161.  
  162. -- [Main program] --
  163.  
  164. itemsSlot()
  165. checkFuel()
  166. height()
  167. lenght()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement