Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- imports
- local rS = require("returnSupplies")
- local cl = require("collect")
- local dR = require("doRefuel")
- -- definition
- local function tryForwards()
- if not dR.doRefuel() then
- print("Not enough Fuel")
- rS.returnSupplies()
- end
- while not turtle.forward() do
- if turtle.detect() then
- if turtle.dig() then
- if not cl.collect() then
- rS.returnSupplies()
- end
- else
- return false
- end
- elseif turtle.attack() then
- if not cl.collect() then
- rS.returnSupplies()
- end
- else
- sleep(0.5)
- end
- end
- xPos = xPos + xDir
- zPos = zPos + zDir
- return true
- end
- -- export
- return { tryForwards = tryForwards }
Add Comment
Please, Sign In to add comment