TheKojent icon

miner

TheKojent | PRO | 04/02/13 01:15:20 AM UTC | 0 ⭐ | 215 👁️ | Never ⏰ | []
Lua |

770 B

|

None

|

0 👍

/

0 👎

os.loadAPI("try")
local done = false
local tArgs = { ... }
if #tArgs ~= 2 then
  print("Usage: miner <shaft depth> <quarry width>")
  return
end
count = tonumber(tArgs[1])
width = tonumber(tArgs[2])
term.clear()
term.setCursorPos(1,1)
print("Place chest in slot 1, bucket of water in slot 2. Press any key to continue.")
os.pullEvent()
for i = 1, count - 2 do
  if not try.down() then
    print("Cannot go down!")
    return
  end
end
if not try.dig() then
  print("Cannot mine block!")
  return
end
for i = 1,2 do
  if not try.down() then
    print("Cannot go down!")
    return
  end
  turtle.select(3 - i) 
  if not try.place() then
    print("Cannot place block!")
    return
  end
end
turtle.select(2)
turtle.drop()
turtle.turnLeft()
turtle.turnLeft()
shell.run("excavate", width)

Comments