Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ######################################
- -- Fortune Block Breaker
- -- version 0.2
- -- http://hevohevo.hatenablog.com/
- -- This Program requires a Fortune Mining Turtle by "More Turtles" mod
- -- http://www.computercraft.info/forums2/index.php?/topic/16465-mc164152-more-turtles-v112/
- -- Side view
- -- T: fortune mining turtle, B: chest for blocks, I: chest for items
- -- B
- -- T
- -- I
- -- Config
- BLOCK_SLOT = 1
- FUEL_SLOT = 16
- SUCK_FUNC = turtle.suckUp
- DROP_FUNC = turtle.dropDown
- local p = peripheral.wrap("right")
- assert((p and p.digFortune), "required Fortune Mining Turtle")
- -- Functions
- function suckBlock() -- return true/false
- turtle.select(BLOCK_SLOT)
- if turtle.getItemCount(BLOCK_SLOT) > 0 then
- return true
- else
- return SUCK_FUNC()
- end
- end
- function waitForEnoughFuel(minLevel, slot)
- local qty = 0
- local refuel = function()
- turtle.select(slot)
- turtle.refuel()
- qty = turtle.getFuelLevel()
- print("fuel: ",qty)
- return qty
- end
- while refuel() < minLevel do
- print(string.format("Insert fuel-items into slot %d: %d/%d", slot, qty, minLevel))
- os.sleep(1)
- os.pullEvent("turtle_inventory")
- end
- end
- function placeDig(count)
- waitForEnoughFuel(count, FUEL_SLOT)
- for i=1,count do
- turtle.select(BLOCK_SLOT)
- turtle.place()
- p.digFortune()
- end
- end
- function dropSeq()
- for i=1,16 do
- turtle.select(i)
- if not DROP_FUNC() then break end
- end
- end
- -- Main
- print("Start: fortune BB")
- while suckBlock() do
- placeDig(turtle.getItemCount(BLOCK_SLOT))
- dropSeq()
- end
- print("Finished: fuel ",turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement