Advertisement
OldDragon2A

transfer (rotatory)

Dec 16th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. -- rotatory transfer
  2. -- moves blocks from one direction to another by turning
  3. -- expects a configuration with an opening (air) a left turn from first target
  4. --   2
  5. -- 1 t ?
  6. --   _
  7.  
  8. local reverse_flow = false -- change the flow of blocks from 1 <- 2 to 1 -> 2
  9. local reverse_side = false -- flip the spin direction so the air is to the right side
  10.  
  11. local first  = turtle.drop
  12. local second = turtle.suck
  13. local right  = turtle.turnRight
  14. local left   = turtle.turnLeft
  15. local temp
  16.  
  17. if reverse_flow then
  18.   temp = first
  19.   first = second
  20.   second = temp
  21. end
  22.  
  23. if reverse_side then
  24.   temp = right
  25.   right = left
  26.   left = temp
  27. end
  28.  
  29. -- reset direction
  30. while turtle.detect() do right() end
  31. while not turtle.detect() do right() end
  32.  
  33. -- start the transfer
  34. while true do
  35.   first()
  36.   right()
  37.   second()
  38.   left()
  39.   sleep(0)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement