Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Program:
- -- mine
- -- Original program by Direwolf20
- -- Modified by Kzorith and even more by Liktorn
- -- Description:
- -- Operates the mining wells and Force Manipulator
- -- Hardware requirements:
- -- 1 Advanced Mining Turtle
- -- 1 Rednet cable
- function turnOff()
- rs.setBundledOutput("bottom",0)
- end
- function startTesseract()
- -- print what we are doing
- print("Mining for 8 seconds")
- -- set a redstone signal to activate the tesseract
- -- (mine is white)
- rs.setBundledOutput("bottom",colors.white)
- -- wait 8 seconds for the mining operation to complete
- sleep(8)
- -- turn off all redstone signals
- turnOff()
- end
- function move()
- --moving the platform
- -- print what we are doing
- print("Moving platform")
- -- wait 5 seconds
- sleep(5)
- -- set a redstone signal to activate the Force Manipulator
- -- (Move is orange)
- rs.setBundledOutput("bottom",colors.orange)
- -- make sure that the Force Manipulator have time to get the signal
- sleep(1)
- -- turn off all redstone signals
- turnOff()
- sleep(4)
- -- and move the turtle 1 forward
- turtle.forward()
- -- and now, check if a block is present in front of the turtle
- -- in that case, clear, and run the clearDebris program
- if turtle.detect() then
- print("Obstacle detected,")
- print("running clearDebris program")
- turtle.forward()
- shell.run("clearDebris")
- end
- end
- function placeChest()
- print("Placing chest")
- turtle.select(1)
- turtle.place()
- sleep(0.5)
- end
- function breakChest()
- print("Breasking chest")
- --brakes the chest in front of it
- turtle.dig()
- end
- function checkCable()
- print("Checking for cable below")
- -- checks if the cable is under the turtle
- -- if not, the miner is stuck
- -- run the clearDebris program
- if turtle.detectDown() then
- -- if true, then everything is allright and the miner can continue
- print("Cable below, continuing")
- placeChest()
- else
- -- no cable detected below. Thst means that the miner is stuck
- -- no chest gets placed, and the main program can't detect
- -- that a block is in the chest.The program pauses
- print("Error: No cable below. Running the clearDebris program")
- -- run the clear program to remove the debris
- shell.run("clearDebris")
- -- move the platform to the new cleared location
- move()
- return
- end
- end
- breakChest()
- startTesseract()
- -- move the platform
- move()
- checkCable()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement