Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Filler --
- -- Refill Product Chest in Slot #1
- -- Fuel Chest in Slot #2
- -- Program Variables --
- local tH = 0
- local cFail = 0
- local isHeadingOut = true
- local numRunsRight = 0
- local slotNum = 3
- local chest = 1
- local fuel = 2
- local swordHand = "left"
- local pickHand = "right"
- local failCheck = 7
- local set = 3
- -- Base Functions Expanded --
- function tA() turtle.attack(swordHand) end
- function tAU() turtle.attackUp(swordHand) end
- function tAD() turtle.attackDown(swordHand) end
- function slp() os.sleep(sL) end
- function tRound() turtle.turnLeft() turtle.turnLeft() end
- function mF()
- if turtle.detect() then turtle.dig(pickHand) end
- while not turtle.forward() do slp() turtle.dig(pickHand) tA() end
- end
- function mB()
- while not turtle.back() do slp() tRound() turtle.dig(pickHand) tA() tRound() end
- end
- function mU()
- if turtle.detectUp() then turtle.digUp(pickHand) end
- while not turtle.up() do slp() turtle.digUp(pickHand) tAU() end
- end
- function mD()
- if turtle.detectDown() then turtle.digDown(pickHand) end
- while not turtle.down() do slp() turtle.digDown(pickHand) tAD() end
- end
- function tR() turtle.turnRight() end
- function tL() turtle.turnLeft() end
- -- Functions Start --
- function calcDown()
- while cFail <= failCheck do
- if turtle.down() then
- tH = tH + 1
- if cFail > 0 then cFail = 0 end
- else
- tAD()
- cFail = cFail + 1
- end
- end
- mU()
- tH = tH - 1
- end
- function refillBlocks()
- turtle.select(chest)
- turtle.placeUp()
- for i = 3,16 do
- turtle.select(i)
- turtle.suckUp(64)
- end
- turtle.select(chest)
- turtle.digUp(pickHand)
- turtle.select(set)
- end
- function refillFuel()
- if turtle.getFuelLevel() < 10000 then
- turtle.select(fuel)
- turtle.placeUp()
- while turtle.getFuelLevel() < 11000 do
- turtle.suckUp(10)
- shell.run("refuel","10")
- end
- turtle.select(fuel)
- turtle.digUp()
- turtle.select(set)
- end
- end
- function placeDown()
- turtle.select(slotNum)
- if turtle.getItemCount() == 0 then
- slotNum = slotNum + 1
- if slotNum <= 16 then
- turtle.select(slotNum)
- else
- refillBlocks()
- slotNum = set
- turtle.select(slotNum)
- end
- end
- turtle.placeDown()
- end
- function placeRow()
- for i = 1,16 do
- placeDown()
- if not (i == 16) then
- mF()
- end
- end
- end
- function endTurn()
- if isHeadingOut then
- isHeadingOut = not isHeadingOut
- tR()
- mF()
- tR()
- else
- isHeadingOut = not isHeadingOut
- if not (numRunsRight == 16) then
- tL()
- mF()
- tL()
- else
- mU()
- tR()
- tH = tH - 1
- end
- end
- end
- function loopFloor()
- for i = 1,16 do
- numRunsRight = i
- placeRow()
- endTurn()
- end
- end
- function runQuad()
- while tH > 0 do
- refillFuel()
- loopFloor()
- end
- end
- -- Main Loop --
- calcDown()
- runQuad()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement