Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ____ ____ _ _ ____ _ _ ____ ____ ____ ____
- -- [__ |___ | | |___ |\ | [__ |___ |__| [__ ____ ____ ____ ___ ____ __ _ ___ ____ ____
- -- ___] |___ \/ |___ | \| ___] |___ | | ___] |___ [__] |--< |--' |--| | \| |__> |___ [__]
- --
- -- TURTLE WILL CREATE A 3X3 'TUNNEL' AND MUST BE PLACED ON THE GROUND
- -- // VARIABLES //
- interval = 100 -- This is user defined!
- emptyInventory = 0
- state = 0 -- 0 low; 1 mid-up; 2 top; 3 mid-down
- -- // FUNCTIONS //
- function turtleEmptyInventory()
- if emptyInventory == 1 then
- for i=1,16 do
- turtle.select(i)
- turtle.dropDown(64)
- end
- elseif emptyInventory == 0 then
- print("I can't do it!")
- shell.run(startup)
- end
- end
- function turtleTurnAround()
- turtle.turnRight()
- turtle.turnRight()
- end
- function turtleReturn()
- if (state == 1 or state == 4) then
- turtle.down()
- elseif (state == 2 or state == 3) then
- turtle.down()
- turtle.down()
- else
- print("turtleReturn")
- end
- for i=1, interval do
- turtle.forward()
- end
- turtleTurnAround()
- print("Emptying Inventory!")
- turtleEmptyInventory()
- os.shutdown()
- end
- function turtleDigRow()
- turtle.turnLeft()
- for i=0,2 do
- while turtle.detect() do
- turtle.select(1)
- turtle.dig()
- sleep(.13)
- if (turtle.getItemCount(16) > 0) then
- print("I have reached maximum capacity!")
- if (i==0) then
- turtle.turnLeft()
- elseif (i==1) then
- turtleTurnAround()
- elseif (i==2) then
- turtle.turnRight()
- else print("turtleDigRow Item Check")
- end
- turtleReturn()
- end
- end
- if (i<2) then
- turtle.turnRight()
- elseif (i==2) then
- turtle.turnLeft()
- else
- print("turtleDigRow")
- end
- end
- end
- function turtleThreeByThree()
- for i=0,2 do
- turtleDigRow()
- if (state == 0 or state == 1) then
- turtle.up()
- state = state + 1
- elseif (state == 2) then
- turtle.forward()
- state = 3
- elseif (state == 3 or state == 4) then
- turtle.digDown()
- turtle.down()
- state = state + 1
- elseif (state == 5) then
- turtle.forward()
- state = 0
- end
- end
- end
- -- // MAIN SCRIPT // --
- for i=1, interval do
- turtleThreeByThree()
- end
- turtleTurnAround()
- turtleReturn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement