Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --replaces block in direction
- function replaceBlock(slot, dir)
- turtle.select(slot)
- if dir == "up" then
- turtle.digUp()
- turtle.placeUp()
- elseif dir == "front" then
- turtle.dig()
- turtle.place()
- elseif dir == "down" then
- turtle.digDown()
- turtle.placeDown()
- end
- end
- --places light in the middle
- function placeLight(lslot)
- turtle.digDown()
- turtle.select(lslot)
- turtle.placeDown()
- end
- --places tracks
- function placeTrack(count, railslot)
- if count == 13 then
- turtle.select(16)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(railslot)
- turtle.place()
- turtle.turnRight()
- elseif count == 14 then
- turtle.select(15)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- elseif count == 15 then
- turtle.select(railslot)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(16)
- turtle.place()
- turtle.turnRight()
- else
- turtle.select(railslot)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- end
- end
- --fuel check
- function checkFuel()
- if turtle.getFuelLevel() < 12 then
- turtle.refuel(1)
- end
- end
- --creates 1 new slice of tunnel
- function newSlice(count, lcount, slot, railslot)
- turtle.turnRight()
- turtle.forward()
- if turtle.compareDown(slot) == false then
- replaceBlock(slot, "down")
- end
- if turtle.compare(slot) == false then
- replaceBlock(slot, "front")
- end
- turtle.up()
- if turtle.compare(slot) == false then
- replaceBlock(slot, "front")
- end
- if turtle.compareUp(slot) == false then
- replaceBlock(slot, "up")
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- if turtle.compareUp(slot) == false then
- replaceBlock(slot, "up")
- end
- turtle.forward()
- if turtle.compareUp(slot) == false then
- replaceBlock(slot, "up")
- end
- if turtle.compare(slot) == false then
- replaceBlock(slot, "front")
- end
- turtle.down()
- if turtle.compare(slot) == false then
- replaceBlock(slot, "front")
- end
- if turtle.compareDown(slot) == false then
- replaceBlock(slot, "down")
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- if lcount == 8 then
- placeLight(14)
- else
- if turtle.compareDown(slot) == false then
- replaceBlock(slot, "down")
- end
- end
- placeTrack(count, railslot)
- turtle.forward()
- end
- loopCounter = 0
- count = 0
- lcount = 0
- ccount = 0
- slot = 2
- railslot = 11
- turtle.refuel(1)
- while loopCounter <= 64 do
- print(count)
- if turtle.getItemCount(slot) < 10 then
- if slot < 10 then
- slot = slot + 1
- else
- os.exit()
- end
- end
- if turtle.getItemCount(railslot) < 2 then
- if railslot < 13 then
- railslot = railslot + 1
- else
- os.exit()
- end
- end
- if ccount == 4 then
- turtle.select(1)
- turtle.refuel(1)
- end
- newSlice(count, lcount, slot, railslot)
- lcount = lcount + 1
- count = count + 1
- ccount = ccount + 1
- if lcount > 8 then
- lcount = 0
- end
- if count > 15 then
- count = 0
- end
- if ccount > 4 then
- ccount = 0
- end
- loopCounter = loopCounter + 1
- end
- os.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement