Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initial Fueling
- turtle.refuel(1)
- -- variable to tell main function when to stop
- local o = 1
- -- Function to get the fuel level of the robot as a number
- fcount = function()
- return turtle.getFuelLevel()
- end
- -- Move forward, Fuel Check and Refuel function
- forwardCheck = function()
- turtle.dig()
- turtle.forward()
- if fcount() < 1 then
- turtle.select(1)
- print ("Attempting to eat my fuel...")
- if turtle.getItemCount(1) < 1 then
- print ("I am out of fuel...")
- o = 0
- end
- turtle.refuel(1)
- turtle.select(2)
- end
- end
- downCheck = function()
- turtle.digDown()
- turtle.down()
- if fcount() < 1 then
- turtle.select(1)
- print ("Attempting to eat my fuel...")
- if turtle.getItemCount(1) < 1 then
- print ("I am out of fuel...")
- o = 0
- end
- turtle.refuel(1)
- turtle.select(2)
- end
- end
- -- Checks for bedrock and empty spaces
- bedCheck = function()
- turtle.digDown()
- if turtle.detectDown() then
- turtle.digDown()
- if turtle.detectDown() then
- o = 0
- end
- end
- end
- -- Checks for lack of steps, and places blocks when needed. Uses slot 2 to place blocks
- checkNot = function()
- turtle.down()
- if not turtle.detectDown() then
- turtle.select(2)
- turtle.placeDown()
- turtle.select(1)
- turtle.up()
- else
- turtle.up()
- end
- end
- dig = function()
- turtle.digUp() -- makes sure no block above
- bedCheck() -- digs down
- checkNot() -- makes sure there is solid step
- forwardCheck() -- move forward and digs if needed
- end
- while o == 1 do
- turtle.turnLeft()
- turtle.dig()
- dig()
- turtle.dig()
- dig()
- turtle.digUp()
- bedCheck()
- checkNot()
- turtle.turnRight() -- after 3 spaces dug, turns right
- turtle.dig()
- forwardCheck() -- moves forward (digs if necessary)
- bedCheck() -- digs down
- downCheck() -- move to next layer of stairs (above by one block)
- bedCheck() -- cleans next layer
- turtle.turnRight() -- turns to start completing next layer
- turtle.dig()
- dig()
- turtle.dig()
- dig()
- turtle.digUp()
- bedCheck()
- checkNot()
- turtle.turnLeft()
- turtle.dig()
- forwardCheck() -- moves forward (digs if necessary)
- bedCheck() -- digs down
- downCheck() -- move to next layer of stairs (above by one block)
- bedCheck() -- cleans next layer
- end
Advertisement
Add Comment
Please, Sign In to add comment