Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local slotFuel = 1
- local slotStone = 2
- local slotWood = 3
- local slotLivingrock = 4
- local slotLivingwood = 5
- local livingrock = "Botania:livingrock"
- local livingwood = "Botania:livingwood"
- local stopBlock = livingrock
- local numPureDaisies = 4
- local numBlocks = (numPureDaisies * 3) + 1
- local timeToKill = false
- function refuel()
- if (turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1) then
- turtle.select(slotFuel)
- turtle.suckDown(64)
- turtle.refuel(64)
- end
- end
- function pickUpStone(numWood)
- turtle.turnRight()
- turtle.select(slotStone)
- turtle.drop(64)
- turtle.suck(numBlocks + (numBlocks - numWood))
- return turtle.getItemCount(slotStone)
- end
- function pickUpWood(numStone)
- turtle.turnRight()
- turtle.select(slotWood)
- turtle.drop(64)
- turtle.suck(numBlocks + (numBlocks - numStone))
- turtle.turnRight()
- turtle.turnRight()
- return turtle.getItemCount(slotWood)
- end
- function resupply()
- numStone = pickUpStone(numBlocks)
- numWood = pickUpWood(numStone)
- if (numStone > 0 and numWood < numBlocks) then
- numStone = pickUpStone(numWood)
- turtle.turnLeft()
- end
- end
- function dumpItems()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- for (i = 4, 16) do
- turtle.select(i)
- turtle.drop(64)
- end
- turtle.turnRight()
- end
- function mine()
- local blockInfront, blockData = turtle.inspectDown()
- if (blockData.name == livingrock) then
- turtle.select(slotLivingrock)
- elseif (blockData.name == livingwood) then
- turtle.select(slotLivingwood)
- end
- if (blockData.name == livingwood or blockData.name == livingrock) then
- turtle.digDown()
- end
- end
- function place()
- turtle.select(slotStone)
- if (turtle.getItemCount(slotStone) == 0) then
- turtle.select(slotWood)
- end
- turtle.placeDown()
- end
- refuel()
- resupply()
- while true do
- local blockInfront, blockData = turtle.inspect()
- if (blockInfront and blockData.name == stopBlock) then
- dumpItems()
- refuel()
- resupply()
- if (timeToKill) then
- print("Shutting down...")
- return
- end
- if (numStone == 0 and numWood == 0) then
- print("Sleeping for 60 seconds, shutting down after next round - out of wood and stone")
- timeToKill = true
- sleep(20)
- end
- sleep(48 - (numPureDaisies * 2))
- end
- turtle.forward()
- if (blockData.name == livingwood) then
- turtle.turnLeft()
- else
- mine()
- place()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement