Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- -- Actual length = length*torchesInterval
- local length = 10
- local torchesInterval = 10
- local branches = 2
- local branchesinterval = 4
- local torchSlot = 1
- local chestSlot = 2
- local blockSlot = 3
- local fuelNeed = length * (torchesInterval+2)
- local function forward()
- while (not turtle.forward()) do
- if (turtle.detect()) then
- turtle.dig()
- else
- turtle.attack()
- end
- end
- end
- local function down()
- while (not turtle.down()) do
- if (turtle.detectDown()) then
- turtle.digDown()
- else
- turtle.attackDown()
- end
- end
- end
- local function up()
- while (not turtle.up()) do
- if (turtle.detectUp()) then
- turtle.digUp()
- else
- turtle.attackUp()
- end
- end
- end
- local function dig()
- turtle.digDown()
- end
- local function alwaysFalse()
- return false
- end
- local function placeBlock(detect, place, slot)
- if (not detect()) then
- turtle.select(slot)
- place()
- end
- end
- local function place(slot)
- down()
- dig()
- placeBlock(alwaysFalse, turtle.placeDown, blockSlot)
- up()
- placeBlock(alwaysFalse, turtle.placeDown, slot)
- end
- local function branchLoop()
- for b=1, branches do
- for i=1, length do
- for j=1, torchesInterval do
- forward()
- placeBlock(turtle.detectUp, turtle.placeUp, blockSlot)
- dig()
- end
- place(torchSlot)
- end
- turtle.turnLeft()
- for i=1, branchesinterval do
- forward()
- placeBlock(turtle.detectUp, turtle.placeUp, blockSlot)
- dig()
- end
- place(torchSlot)
- turtle.turnRight()
- forward()
- place(chestSlot)
- for k=16, blockSlot+1, -1 do
- turtle.select(k)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- forward()
- end
- end
- local function mainLoop()
- branchLoop()
- end
- mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement