Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- compass=peripheral.wrap("right")
- local start = true
- --Config
- local space = 10
- local directions = 0
- --Inventory:
- --Fuel,#,#,#
- --#,#,#,#
- --#,#,#,#
- --#,#,Torches(optional),Ender Chest
- --[[
- Type:
- PeripheralLeft - PickAxe
- PeripheralRight - Compass
- --]]
- while true do
- function direction()
- if compass.getFacing() >= directions then
- return compass.getFacing() - directions
- else
- return compass.getFacing() + 4 - directions
- end
- end
- function refuelSelf()
- if turtle.getFuelLevel()<500 then
- while turtle.getFuelLevel()<500 do
- for i=1,16,1 do
- turtle.select(i)
- turtle.refuel(1)
- turtle.select(1)
- end
- end
- end
- end
- function fillChest()
- for i=2,14,1 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(16)
- os.sleep(8)
- if turtle.getItemCount(16) > 0 then
- for i = 2, 14, 1 do
- if turtle.transferTo(i) then
- break
- end
- if i == 14 then
- os.terminate()
- end
- end
- end
- turtle.digDown()
- turtle.select(15)
- turtle.digUp()
- turtle.dig()
- turtle.place()
- turtle.select(1)
- end
- function align()
- if direction()==0 then
- turtle.turnLeft()
- if not turtle.forward() then
- turtle.turnRight()
- turtle.turnRight()
- end
- elseif direction()==2 then
- os.terminate()
- end
- end
- function turnAround()
- if direction()==3 then
- turtle.select(16)
- if turtle.getItemCount(16) > 1 then
- os.terminate()
- end
- while not turtle.placeDown() do
- turtle.digDown()
- end
- fillChest()
- turtle.turnRight()
- turtle.dig()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- elseif direction()==1 then
- turtle.select(16)
- if turtle.getItemCount(16) > 1 then
- os.terminate()
- end
- while not turtle.placeDown() do
- turtle.digDown()
- end
- fillChest()
- turtle.turnLeft()
- turtle.dig()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.digUp()
- turtle.digDown()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- if not turtle.forward() then
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- end
- --Startup
- if start == true then
- print("Hi! My name is Liam!")
- print("Job: Mining")
- print("")
- print("Inventory:")
- print("Fuel,#,#,#")
- print("#,#,#,#")
- print("#,#,#,#")
- print("#,#,Torches(optional),Ender Chest")
- print("")
- turtle.turnLeft()
- turtle.turnLeft()
- while turtle.forward() do
- end
- turtle.turnRight()
- turtle.turnRight()
- start=false
- end
- --Main
- align()
- for i=0,space,1 do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- while not turtle.forward() do
- turtle.dig()
- refuelSelf()
- end
- end
- turnAround()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement