Bonkie

Quarry setup Main

Sep 16th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 KB | None | 0 0
  1. qSize = 64
  2. function needsFuel()
  3.     local level=turtle.getFuelLevel()
  4.     if level=="unlimited" or level>500 then
  5.         return false
  6.     else
  7.         turtle.select(16)
  8.         turtle.refuel()
  9.     end
  10. end
  11.  
  12. function blockENmarker()
  13.   print("Marker plaatsen")
  14.   turtle.select(1)
  15.   turtle.placeDown()
  16.   turtle.up()
  17.   turtle.select(2)
  18.   turtle.placeDown()
  19. end
  20.  
  21. function vooruit(e)
  22.   for i=1,e do
  23.     turtle.forward()
  24.   end
  25. end
  26.  
  27. function buildMine()
  28.   redstone.setAnalogOutput("top",0)
  29.   needsFuel()
  30.   print("Naar marker 1")
  31.   turtle.forward()
  32.   turtle.up()
  33.   blockENmarker()
  34.  
  35.   print("Naar marker 2")
  36.   vooruit(qSize-1)
  37.   turtle.down()
  38.   blockENmarker()
  39.  
  40.   print("Naar marker 3")
  41.   turtle.turnRight()
  42.   turtle.turnRight()
  43.   vooruit(qSize-1)
  44.   turtle.turnRight()
  45.   vooruit(qSize-1)
  46.   turtle.down()
  47.   blockENmarker()
  48.   print("Return to start")
  49.   --return to start
  50.   needsFuel()
  51.   turtle.turnRight()
  52.   turtle.turnRight()
  53.   vooruit(qSize-2)
  54.   turtle.down()
  55.   turtle.down()
  56.   turtle.turnRight()
  57.   turtle.forward()
  58.   turtle.turnLeft()
  59.   turtle.forward()
  60.   turtle.turnLeft()
  61.   redstone.setAnalogOutput("top",15)
  62.   sleep(1)
  63. end
  64.  
  65. function placeQuarry()
  66.   redstone.setAnalogOutput("top",0)
  67.   turtle.forward()
  68.   turtle.select(4)
  69.   turtle.placeUp()
  70.   turtle.back()
  71.   sleep(2)
  72.   redstone.setAnalogOutput("top",14)
  73.   sleep(1)
  74. end
  75.  
  76. function pickupQuarry()
  77.   print("Quarry oppakken")
  78.   turtle.forward()
  79.   turtle.turnLeft()
  80.   turtle.forward()
  81.   turtle.select(4)
  82.   turtle.digUp()
  83.   turtle.back()
  84.   turtle.turnRight()
  85.   turtle.back()
  86.   redstone.setAnalogOutput("top",13)
  87.   sleep(1)
  88. end
  89.  
  90. function placeInSleep()
  91.   print("Mining turtle in slaapstand zetten")
  92.   redstone.setAnalogOutput("top",0)
  93.   turtle.turnRight()
  94.   turtle.forward()
  95.   turtle.turnLeft()
  96. end
  97.  
  98. function gotoNextStart()
  99.   print("Naar volgende Quarry punt gaan")
  100.   turtle.turnLeft()
  101.   turtle.forward()
  102.   turtle.forward()
  103.   turtle.turnRight()
  104.   turtle.forward()
  105.   turtle.turnRight()
  106.   vooruit(qSize-1)
  107.   turtle.turnLeft()
  108. end
  109.  
  110. redstone.setAnalogOutput("top",0)
  111. print("wachtten op top redstone")
  112. sleep(1)
  113. while true do
  114.   os.pullEvent("redstone")
  115.   topRedstone = redstone.getAnalogInput("top")
  116.   print(topRedstone)
  117.   if topRedstone==15 then
  118.     buildMine()
  119.   elseif topRedstone==14 then
  120.     turtle.back()
  121.   elseif topRedstone==13 then
  122.     placeQuarry()
  123.   elseif topRedstone==12 then
  124.     placeInSleep()
  125.   elseif topRedstone==11 then
  126.     pickupQuarry()
  127.   elseif topRedstone==10 then
  128.     gotoNextStart()
  129.   end
  130. end
Advertisement
Add Comment
Please, Sign In to add comment