Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local usedFuel = 0
- function fuelChk()
- if turtle.getFuelLevel() < 20 then
- turtle.select(1)
- if turtle.refuel(1) == false then
- print("Out of fuel!")
- exit()
- end
- usedFuel = usedFuel + 1
- end
- end
- function doStuffAndThings()
- print("Thank you for using our amazing freaking program")
- print("Q009 says hello")
- print("Please specify length of the area")
- local len = io.read()
- print("Please specify width of the area")
- local width = io.read()
- len = tonumber(len)
- width = tonumber(width)
- local foundMats = 0
- if len < 4 then len = 4 end
- if width < 4 then width = 4 end
- fuelChk()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- turtle.forward()
- for i = 1, len, 1 do
- fuelChk()
- if i % 2 == 0 then turtle.turnRight()
- else turtle.turnLeft() end
- for j = 1, width, 1 do
- turtle.select(2)
- if turtle.detectDown() and turtle.compareDown()
- then
- turtle.digDown()
- foundMats = foundMats + 1
- end
- while (turtle.detect()) and (j < width) do
- turtle.dig()
- sleep(0.5)
- end
- if j < width then turtle.forward() end
- end
- if i % 2 == 0 then turtle.turnLeft()
- else turtle.turnRight() end
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- turtle.forward()
- end
- turtle.back()
- if len % 2 ~= 0 then
- turtle.turnRight()
- for i = 1, width, 1 do turtle.forward() end
- turtle.turnLeft()
- end
- turtle.turnLeft() turtle.turnLeft()
- for i = 1, len, 1 do turtle.forward() end
- print("Done! Used fuel: " .. usedFuel .. " | ammount mined material: " .. foundMats)
- end
- doStuffAndThings()
Advertisement
Add Comment
Please, Sign In to add comment