Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local depth=30
- local bdepth=30
- local currentDepth=0
- local currentSide="blank"
- function forward(num1)
- for i=1, num1 do
- turtle.forward()
- end
- end
- function toChest()
- local steps = 0
- turtle.turnLeft()
- turtle.turnLeft()
- forward(currentDepth+2)
- if currentSide == "Right" then
- turtle.turnLeft()
- while turtle.detect() == == true do
- turtle.forward()
- steps = steps + 1
- end
- for i=1, 15 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- forward(steps)
- turtle.turnRight()
- while turtle.detect() == false do
- turtle.forward()
- end
- else
- turtle.turnRight()
- while turtle.detect() == == true do
- turtle.forward()
- steps = steps + 1
- end
- for i=1, 15 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- forward(steps)
- turtle.turnLeft()
- while turtle.detect() == false do
- turtle.forward()
- end
- end
- end
- function getInv()
- local InvCount=0
- for i=1, 15 do
- InvCount= InvCount + turtle.getItemCount(i)
- end
- return InvCount
- end
- function checkFullInv(char1)
- if char1 == "dig" then
- Num1=getInv()
- turtle.dig()
- num2=getInv()
- if num1 == num2 then
- toChest()
- end
- else if char1 == "digup" then
- Num1=getInv()
- turtle.digUp()
- num2=getInv()
- if num1 == num2 then
- toChest()
- end
- else if char1 == "digdown" then
- Num1=getInv()
- turtle.digDown()
- num2=getInv()
- if num1 == num2 then
- toChest()
- end
- else
- print("invalid pass")
- end
- end
- ---Turtle will clear one column of blocks
- function column()
- while turtle.detect() == true do
- checkFullInv(dig)
- os.sleep(0.15)
- end b
- turtle.forward()
- while turtle.detectUp() == true do
- checkFullInv(digup)
- os.sleep(0.15)
- end
- checkFullInv(digdown)
- end
- function line(num1)
- for i=1, num1 do
- column()
- currentDepth= currentDepth + 1
- end
- currentDepth=0
- end
- ---Turtle needs to create the primary shaft of the mine
- ---depth is defined by the user "Depth"
- function shaft() ---Shaft is 3x3
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- line(depth)
- turtle.turnLeft()
- column()
- turtle.turnLeft()
- line(depth-1)
- turtle.turnRight()
- column()
- turtle.turnRight()
- line(depth-1)
- end
- ---function to return back to start location
- ---start location will be center of 3x3 on beginning face
- function backtoShaftStart()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- forward(depth-1)
- turtle.turnRight()
- turtle.turnRight()
- end
- ---start branch mine, there will be shaft on each side of the path
- ---the branch itself will be 2 blocks on center (BXXB)
- ---depth of the branch will be defined by bdepth
- function branch()
- ---turtle needs to determine howmany branches to make
- branchcount= math.floor(depth / 3)
- ---turtle to start on right side
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- currentSide="Right"
- for x=1, 2 do
- for i=1, branchcount do
- line(bdepth)
- turtle.turnLeft()
- turtle.turnLeft()
- forward(bdepth+1)
- if i < branchcount
- turtle.turnRight()
- forward(3)
- turtle.turnRight()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- currentSide="Left"
- end
- turtle.forward()
- turtle.turnLeft()
- turtle.back()
- end
- ---initialize the program
- ---user input required for bdepth and depth
- function Main()
- ---Start with shaft
- shaft()
- backtoShaftStart()
- branch()
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement