Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Turtle Multiple Branch Mine #1")
- print("Name: ", os.getComputerLabel() )
- print("Fuel Level: ", turtle.getFuelLevel())
- function DigUp()
- print("Up")
- while turtle.detectUp()
- do turtle.digUp()
- sleep(0.4)
- end
- turtle.up()
- end --of DigUp
- -- Dig Foward
- function DigFwd()
- print("Forward")
- while turtle.detect() do
- turtle.dig()
- sleep(0.4)
- end
- turtle.forward()
- end -- of Dig Fwd
- -- DigDwn
- function DigDwn()
- print("Down")
- while turtle.detectDown()
- do turtle.digDown() end
- turtle.down()
- end -- of DigDown
- -- Place torch
- function PlaceTorch()
- print("Place Torch")
- turtle.back()
- turtle.back()
- turtle.turnRight()
- turtle.select(16)
- turtle.placeUp()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- end -- of PlaceTorch
- -- Dig a Segment and place torch
- function DigSegment(Length)
- for i=1,Length,1 do
- DigFwd()
- DigUp()
- DigFwd()
- DigDwn()
- end -- for loop for dig cycle
- end -- DigSegment function
- -- Turn Back
- function TurnBack()
- turtle.turnLeft()
- DigFwd()
- DigUp()
- DigFwd()
- DigDwn()
- DigFwd()
- DigUp()
- turtle.down()
- PlaceTorch()
- turtle.turnLeft()
- end
- -- End Turn Back function
- -- Start Another Branch
- function StartAnotherBranch()
- turtle.turnRight()
- turtle.forward()
- turtle.select(15)
- turtle.turnLeft()
- turtle.place()
- if turtle.detect()
- then
- for slot=1,14,1 do
- turtle.select(slot)
- turtle.drop()
- end -- for each slot in inventory
- end -- If chest placed
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end -- function StartAnotherBranch
- ---------------------------
- -- Main Program
- NumSeg=2 -- Number of segments before turning back
- SegLen=4 -- Length of Segment between Torches
- NumBranch=3 -- Number of Branches to Mine
- for branch=1,NumBranch,1 do
- for seg=1,NumSeg,1 do
- DigSegment(SegLen)
- PlaceTorch()
- end -- Distance to dig forward
- TurnBack()
- for seg=1,NumSeg,1 do
- DigSegment(SegLen)
- PlaceTorch()
- end -- Distance to dig back toward start
- StartAnotherBranch()
- end -- for each branch to mine
Advertisement
Add Comment
Please, Sign In to add comment