Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ######################################
- -- harvest cactus
- -- version 0.2
- -- http://hevohevo.hatenablog.com/
- -- Turtle goes forward and harvests cactuses basically.
- -- When he reaches an order block, run the order; stop, turn right, turn left.
- -- I recommend that this program names "startup".
- -- ############### Side View
- -- T: Trutle, C: Cactus
- -- T=> C
- -- C
- -- C
- -- ############### Top View:
- -- T: Trutle, C: Cactus, S: Block for stopping(e.g. a chest),
- -- R: Block for turning right, L: Block for turning left
- -- R R
- -- R R
- -- C C C C
- -- C C C C
- -- C C C C
- -- C C C C
- --
- --ST
- -- LR
- -- L
- -- Config
- BLOCK_TURN_LEFT = 13
- BLOCK_TURN_RIGHT = 14
- BLOCK_STOP = 15
- FUEL = 16
- MIN_FUEL_LEVEL = 100
- SLEEP_TIME = 600 -- seconds
- function get_cactus()
- turtle.select(1)
- turtle.forward()
- turtle.suck()
- turtle.dig()
- turtle.digDown()
- end
- while true do
- repeat -- start
- get_cactus()
- turtle.select(BLOCK_TURN_RIGHT)
- if turtle.compare() then turtle.turnRight() end
- turtle.select(BLOCK_TURN_LEFT)
- if turtle.compare() then turtle.turnLeft() end
- turtle.select(BLOCK_STOP)
- until turtle.compare() -- end
- -- drop cactus to the chest
- for i=1,12 do
- turtle.select(i)
- if not turtle.drop() then break end
- end
- turtle.turnRight()
- os.sleep(SLEEP_TIME)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement