Advertisement
MrHG

Bridge

Aug 2nd, 2022 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. -- bridge
  2. os.loadAPI("t")
  3. local args = {...}
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. print("Attempting to bridge.")
  7. turtle.select(1)
  8. diagonalRight = false
  9. diagonalLeft = false
  10. messageSent = false
  11. if #args > 0 then
  12. if args[1] == "right" then
  13. diagonalRight = true
  14. elseif args[1] == "left" then
  15. diagonalLeft = true
  16. else
  17. print("Please specify left or right")
  18. end
  19. end
  20. while true do
  21. if turtle.getItemCount() > 0 then
  22. messageSent = false
  23. t.forward(1)
  24. t.digDown(1)
  25. t.placeDown(1)
  26. if diagonalRight then
  27. if turned then
  28. turtle.turnLeft()
  29. turned = false
  30. else
  31. turtle.turnRight()
  32. turned = true
  33. end
  34. end
  35. if diagonalLeft then
  36. if turned then
  37. turtle.turnRight()
  38. turned = false
  39. else
  40. turtle.turnLeft()
  41. turned = true
  42. end
  43. end
  44. else
  45. if messageSent == false then
  46. print("Insert more blocks in slot 1 to continue.")
  47. messageSent = true
  48. end
  49. sleep(5)
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement