Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg = {...}
- local x = tonumber(arg[1])
- local y = tonumber(arg[2])
- local poop = 0
- function clearScreen()
- term.clear()
- term.setCursorPos(1,1)
- end
- function zigzag()
- if poop == 0 then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.digDown()
- poop = 1
- elseif poop == 1 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.digDown()
- poop = 0
- else
- print("dig() error!")
- end
- end
- function dig()
- local myX, myY
- for myY = 1, y do
- for myX=1, x do
- clearScreen()
- print(turtle.getFuelLevel())
- turtle.forward()
- turtle.digDown()
- if turtle.getItemCount(14) >= 1 then
- unloadItems()
- end
- end
- print("attempting zigzag")
- zigzag() -- Zigs and Zags
- end
- end
- function readyCheck() -- Returns true if a chest is found in inventory slot 16.
- local chest = turtle.getItemDetail(16)
- if (chest == nil) or (chest == nil) then
- print("I'm not prepared to mine!")
- print("I need an Ender Chest in slot 16.")
- print("Press any key to continue.")
- os.pullEvent("key")
- return false
- else
- return true
- end
- end
- function unloadItems()
- -- Rotate turtle to Rear
- turtle.turnLeft()
- turtle.turnLeft()
- -- turtle selects ender chest
- turtle.select(16)
- -- turtle place ender chest
- turtle.place()
- -- turtle loops placing items into chest
- for i=1,14 do
- turtle.select(i)
- turtle.drop()
- end
- -- turtle selects inv for ender chest
- turtle.select(16)
- -- turtle mines
- turtle.dig()
- -- turtle faces original direction
- turtle.turnLeft()
- turtle.turnLeft()
- end
- -- MAIN CODE BEGINS --
- print("X:",x," Y:",y)
- print("poop:", poop)
- readyCheck()
- turtle.digDown()
- dig()
- while turtle.down() do
- dig()
- end
- -- MAIN CODE ENDS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement