Advertisement
Plazter

Quarry - Engineering turtle

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