Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg = ...
- local dist = 0
- local maxInv = 16
- local function Refuel()
- for i = 1, maxInv do
- turtle.select(i)
- turtle.refuel(64)
- end
- end
- local function Dig(distance)
- for i = 1, distance do
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- end
- end
- local function Return(distance)
- for i = 1, distance do
- turtle.back()
- end
- end
- local function TurtleCount()
- local count = 0
- local slots = {}
- for i = 1, maxInv do
- local item = turtle.getItemDetail(i)
- if item ~= nil and item.name == "computercraft:turtle_normal" then
- count = count + 1
- table.insert(slots, i)
- end
- end
- return count, slots
- end
- local function Miner()
- Dig(dist)
- Return(dist)
- end
- local function Captain()
- turtle.turnLeft()
- local turtleCount, turtleSlots = TurtleCount()
- for i = 1, turtleCount - 1 do
- turtle.forward()
- end
- turtle.select(turtleSlots[1])
- turtle.place()
- for i = 1, turtleCount - 1 do
- turtle.back()
- turtle.select(turtleSlots[turtleCount - i])
- turtle.place()
- end
- turtle.turnRight()
- Miner()
- end
- local function ProcArgs()
- if arg ~= nil then
- if string.lower(arg) == "captain" then Captain() return end
- end
- Miner()
- end
- local function ReadDistance()
- while true do
- write("Enter distance: ")
- dist = tonumber(read())
- if dist ~= 0 then break end
- end
- end
- local function Init()
- ReadDistance()
- ProcArgs()
- end
- Init()
Add Comment
Please, Sign In to add comment