Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gTorchSlot=1
- gBridgeSlot=2
- gFuelSlot=3
- gLineNumber=1
- gBrancheNumber=2
- gLineGap=14
- gBranchGap=3
- gPosLine=0
- gPosBranch=0
- gPosStrip=0
- function move(moveLength,moveDirection)
- -- moves
- -- 0 forward
- -- 1 back
- -- 2 up
- -- 3 down
- for i=1,moveLength do
- if moveDirection==0 then
- while turtle.forward()==false do end
- elseif moveDirection==1 then
- while turtle.back()==false do end
- elseif moveDirection==2 then
- while turtle.up()==false do end
- elseif moveDirection==3 then
- while turtle.down()==false do end
- end
- end
- end
- function turnAround()
- -- turns the turtle 180°
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function moveTo(moveToLine,moveToBranch,moveToStrip)
- -- moves turtle to defined position
- function mineFwd(digLength,torchAtEnd)
- -- mines 1×2 tunnel (start top block)
- -- if torchAtEnd==true, places torch on last block
- for iFwd=1,digLength do
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.5)
- end
- move(1,0)
- turtle.digDown()
- move(1,3)
- if turtle.detectDown() == false then
- turtle.select(bridgeSlot)
- turtle.placeDown()
- end
- move(1,2)
- end
- if torchAtEnd then
- turtle.select(torchSlot)
- turtle.placeDown()
- end
- end
- function branch(branchNum,branchDist,branchLength)
- -- creates branches
- for iBranch=1,branchNum do
- mineFwd(branchDist,true)
- turtle.turnRight()
- mineFwd(branchLength,false)
- turnAround()
- move(branchLength,0)
- mineFwd(branchLength,false)
- move(branchLength,1)
- turtle.turnRight()
- end
- move(branchNum*branchDist,1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement