Advertisement
Liktorn

Liktorn's Mining Turtle

Apr 27th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Program:
  2. --   mine
  3. -- Original program by Direwolf20
  4. -- Modified by Kzorith and even more by Liktorn
  5. -- Description:
  6. --   Operates the mining wells and Force Manipulator
  7. -- Hardware requirements:
  8. --   1 Advanced Mining Turtle
  9. --   1 Rednet cable
  10.  
  11. function turnOff()
  12.     rs.setBundledOutput("bottom",0)
  13. end
  14. function startTesseract()
  15.     --  print what we are doing
  16.     print("Mining for 8 seconds")
  17.     --  set a redstone signal to activate the tesseract
  18.     --    (mine is white)
  19.     rs.setBundledOutput("bottom",colors.white)
  20.     --  wait 8 seconds for the mining operation to complete
  21.     sleep(8)
  22.     --  turn off all redstone signals
  23.     turnOff()
  24. end
  25.  
  26. function move()
  27.     --moving the platform
  28.     --  print what we are doing
  29.     print("Moving platform")
  30.     --  wait 5 seconds
  31.     sleep(5)
  32.     --  set a redstone signal to activate the Force Manipulator
  33.     --    (Move is orange)
  34.     rs.setBundledOutput("bottom",colors.orange)
  35.     -- make sure that the Force Manipulator have time to get the signal
  36.     sleep(1)
  37.     --  turn off all redstone signals
  38.     turnOff()
  39.     sleep(4)
  40.     -- and move the turtle 1 forward
  41.     turtle.forward()
  42. end
  43.  
  44. function placeChest()
  45.     print("Placing chest")
  46.     turtle.select(1)
  47.     turtle.place()
  48.     sleep(0.5)
  49.  
  50. end
  51.  
  52. function breakChest()
  53.     print("Breasking chest")
  54.     --brakes the chest in front of it
  55.     turtle.dig()
  56. end
  57.  
  58. function checkCable()
  59.     print("Checking for cable below")
  60.     -- checks if the cable is under the turtle
  61.     -- if not, the miner is stuck
  62.     -- break the program
  63.     if turtle.detectDown() then
  64.         print("Cable below, continuing")
  65.         placeChest()
  66.     else
  67.         while true do
  68.             print("Error: No cable below. Miner stuck. Infinite loop")
  69.             return
  70.         end
  71.     end
  72. end
  73.  
  74. breakChest()
  75. startTesseract()
  76.  
  77.  
  78.  
  79. -- move the platform
  80. move()
  81. checkCable()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement