Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Notes
- --Slot 1 = Fuel
- --Slot 2 = Torch (Not yet Used)
- --Slot 3-16 = Cobble
- --Find slot with something in it. Cobble.
- --Needs to be enhanced
- function findBlock()
- for slot = 3,16 do
- if turtle.getItemCount(slot) >0 then
- turtle.select(slot)
- break
- end
- end
- end
- --Simple detect block in front, if false then move one block forward
- function moveForward()
- if turtle.detect() == false then
- place()
- turtle.forward()
- end
- end
- --detect if block below and place
- function place()
- if turtle.detectDown() == false then
- turtle.placeDown()
- end
- end
- --refuel from slot 1
- function refuel()
- turtle.select(1)
- turtle.refuel()
- end
- --turn right
- function turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.placeDown()
- turtle.turnRight()
- end
- --turn left
- function turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.placeDown()
- turtle.turnLeft()
- end
- --Main Loop check fuel check inventory and begin movement
- function mainLoop()
- if turtle.getFuelLevel() <= 1 then
- refuel()
- elseif turtle.getItemCount() <= 1 then
- findBlock()
- elseif (turtle.getFuelLevel()>0) and (turtle.getItemCount()>0) then
- moveForward()
- end
- end
- repeat mainLoop()
- repeat turnRight()
- until turtle.detect() == false
- until turtle.detect() == true
Add Comment
Please, Sign In to add comment