Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get ezcuP8Aw bin/quarry.lua
- -- Config
- local FUEL_CHEST = 1 -- Slot for fuel chest
- local ITEM_CHEST = 2 -- Slot for items chest
- local MAX_HEIGHT = 0
- local MIN_HEIGHT = -59 -- Minimum height when digging down
- -- Local variables
- local direction = START_DIRECTION
- local startPos
- local startHeading
- if not fs.exists("lib/serialize.lua") then
- shell.run("pastebin", "get", "WdDfvs6u", "lib/serialize.lua")
- end
- os.loadAPI("lib/serialize.lua")
- if not fs.exists("lib/serialize.lua") then
- shell.run("pastebin", "get", "Gp82YPAm", "lib/LAML.lua")
- end
- os.loadAPI("lib/LAML.lua")
- function EmptyInventory()
- turtle.select(ITEM_CHEST)
- turtle.digUp()
- turtle.placeUp()
- for slot = 3, 16 do
- turtle.select(slot)
- turtle.dropUp()
- end
- turtle.select(ITEM_CHEST)
- turtle.digUp()
- end
- function Refuel()
- turtle.select(FUEL_CHEST)
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.placeUp()
- turtle.select(FUEL_CHEST)
- turtle.suckUp()
- turtle.refuel()
- turtle.digUp()
- end
- function Check()
- if turtle.getItemCount(16) > 0 then -- Turtle inventory is full
- EmptyInventory()
- end
- if turtle.getFuelLevel() < 100 then
- Refuel()
- end
- end
- function Advance()
- while turtle.detect() do
- turtle.dig()
- end
- LAML.forward()
- end
- function init()
- startPos = serialize.unserialize("startPos")
- startHeading = serialize.unserialize("startHeading")
- LAML.init()
- if startPos ~= nil then
- print(startPos.x)
- print(startPos.y)
- print(startPos.z)
- pos = startPos
- pos.y = LAML.getY()
- LAML.goto(pos)
- LAML.face(startHeading)
- end
- end
- function Main()
- init()
- while true do
- startPos = LAML.getPos()
- startHeading = LAML.getOrientation()
- serialize.serialize(startPos, "startPos")
- serialize.serialize(startHeading, "startHeading")
- offset = 0
- while LAML.getPos().y > MIN_HEIGHT do
- print("Mining y=", LAML.getPos().y)
- for x = 1, 16 do
- for z = 1, 15 do
- Check()
- Advance()
- end
- if ((x + offset) % 2) == 1 then
- LAML.turnRight()
- else
- LAML.turnLeft()
- end
- if not (x == 16) then
- Advance()
- end
- if ((x + offset) % 2) == 1 then
- LAML.turnRight()
- else
- LAML.turnLeft()
- end
- end
- turtle.digDown()
- LAML.down()
- offset = offset + 1
- end
- pos = startPos
- LAML.face(startHeading)
- pos = pos + LAML.getOrientationVector() * 16
- pos.y = MAX_HEIGHT
- LAML.goto(pos)
- LAML.face(startHeading)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement