Bonkie

Quarry Main

Sep 16th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.85 KB | None | 0 0
  1. qSize = 64
  2. redstone.setAnalogOutput("bottom",0)
  3.  
  4. function needsFuel()
  5.     local level=turtle.getFuelLevel()
  6.     if level=="unlimited" or level>500 then
  7.         return false
  8.     else
  9.         turtle.select(16)
  10.         turtle.refuel()
  11.     end
  12. end
  13.  
  14. needsFuel()
  15.  
  16. function vooruit(e)
  17.   for i=1,e do
  18.     turtle.forward()
  19.   end
  20. end
  21.  
  22. function clear()
  23.  term.clear()
  24.  term.setCursorPos (1,1)
  25. end
  26.  
  27. function markersPlaatsen()
  28.   print("Markers plaatsen")
  29.   redstone.setAnalogOutput("bottom",15)
  30.   sleep(1)
  31. end
  32.  
  33. function markersActiveren()
  34.   redstone.setAnalogOutput("bottom",0)
  35.   print("Markers activeren")
  36.   turtle.attack()
  37.   sleep(1)
  38. end
  39.  
  40. function miningBack()
  41.   print("Mining turtle naar achter verplaatsen.")
  42.   redstone.setAnalogOutput("bottom",14)
  43.   sleep(1)
  44. end
  45.  
  46. function engineerBack()
  47.   print("Engineer naar achter verplaatsen.")
  48.   redstone.setAnalogOutput("bottom",0)
  49.   sleep(1)
  50.   turtle.back()
  51.   sleep(1)
  52. end
  53.  
  54. function placeQuarry()
  55.   print("Quarry plaatsen")
  56.   redstone.setAnalogOutput("bottom",13)
  57.   sleep(1)
  58. end
  59.  
  60. function sleepMiningTurtle()
  61.   redstone.setAnalogOutput("bottom",0)
  62.   sleep(1)
  63.   print("Mining turtle in slaap stand zetten")
  64.   redstone.setAnalogOutput("bottom",12)
  65.   sleep(3)
  66. end
  67.  
  68. function placeEnergyItemsSleep()
  69.   print("Energy en Item tesseract plaatsen")
  70.   redstone.setAnalogOutput("bottom",0)
  71.   turtle.back()
  72.   turtle.select(1)
  73.   turtle.place()
  74.   turtle.up()
  75.   turtle.forward()
  76.   turtle.select(2)
  77.   turtle.place()
  78.   turtle.turnRight()
  79.   turtle.forward()
  80.   turtle.turnLeft()
  81.   turtle.down()
  82. end
  83.  
  84. function picupEnergyItems()
  85.   print("Energy en Item tesseract Oppakken")
  86.   redstone.setAnalogOutput("bottom",0)
  87.  
  88.   turtle.up()
  89.   turtle.turnLeft()
  90.   turtle.forward()
  91.   turtle.turnRight()
  92.  
  93.   turtle.select(1)
  94.   turtle.digDown()
  95.  
  96.   turtle.select(2)
  97.   turtle.dig()
  98.  
  99.   turtle.turnRight()
  100.   turtle.forward()
  101.   turtle.turnLeft()
  102.   turtle.down()
  103.  
  104. end
  105.  
  106. function pickupQuarry()
  107.   print("Quarry oppakken")
  108.   redstone.setAnalogOutput("bottom",11)
  109.   sleep(1)
  110. end
  111.  
  112. function gotoNextStart()
  113.   print("Naar volgende Quarry punt gaan")
  114.   redstone.setAnalogOutput("bottom",0)
  115.   sleep(2)
  116.   redstone.setAnalogOutput("bottom",10)
  117.   sleep(2)
  118.   redstone.setAnalogOutput("bottom",0)
  119.   turtle.turnLeft()
  120.   turtle.forward()
  121.   turtle.forward()
  122.   turtle.turnRight()
  123.   turtle.forward()
  124.   turtle.turnRight()
  125.   vooruit(qSize-1)
  126.   turtle.turnLeft()
  127.   sleep(1)
  128. end
  129.  
  130. function nieuwQuarry()
  131.   markersPlaatsen()
  132.   while true do
  133.     os.pullEvent("redstone")
  134.     getBottomRedstone = redstone.getAnalogInput("bottom")
  135.     print(getBottomRedstone)
  136.     if getBottomRedstone == 15 then
  137.       markersActiveren()
  138.       miningBack()
  139.       engineerBack()
  140.       placeQuarry()
  141.     elseif getBottomRedstone==14 then
  142.       sleepMiningTurtle()
  143.       placeEnergyItemsSleep()
  144.       menu()
  145.     end
  146.   end
  147. end
  148.  
  149. function volgendeQuarry()
  150.   picupEnergyItems()
  151.   pickupQuarry()
  152.   while true do
  153.     os.pullEvent("redstone")
  154.     getBottomRedstone = redstone.getAnalogInput("bottom")
  155.     print(getBottomRedstone)
  156.     if getBottomRedstone == 15 then
  157.       markersActiveren()
  158.       miningBack()
  159.       engineerBack()
  160.       placeQuarry()
  161.     elseif getBottomRedstone==14 then
  162.       sleepMiningTurtle()
  163.       placeEnergyItemsSleep()
  164.       menu()
  165.     elseif getBottomRedstone==13 then
  166.       gotoNextStart()
  167.       markersPlaatsen()
  168.     end
  169.   end
  170. end
  171.  
  172. function menu()
  173.   clear()
  174.   print ("-------------------------------------")
  175.   print ("-- 1. Nieuwe mijn                    ")
  176.   print ("-- 2. Volgende mijn                  ")
  177.   print ("-------------------------------------")
  178.   write ("Keuze (1/2): ")
  179.   local keuze = read()
  180.   if keuze=="1" then
  181.     nieuwQuarry()
  182.   elseif keuze=="2" then
  183.     volgendeQuarry()
  184.   else
  185.     print("Er is een verkeerde keuze gemaakt.")
  186.     sleep(1.5)
  187.     menu()
  188.   end
  189. end
  190.  
  191. menu()
Advertisement
Add Comment
Please, Sign In to add comment