Yorbo

siloClose

Oct 21st, 2021
649
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. --- Created by yannb.
  3. --- DateTime: 22/10/2021 04:11
  4. ---
  5. rednet.open("right")
  6.  
  7. function broadcast(message)
  8.     local casts = 0
  9.     while casts < 110 do
  10.         casts = casts + 1
  11.         rednet.send(casts, message)
  12.     end
  13. end
  14.  
  15. function oneLine()
  16.     while not turtle.detect() do
  17.         turtle.forward()
  18.         turtle.placeUp()
  19.     end
  20. end
  21.  
  22. function placeCount(count)
  23.     while count > 0 do
  24.         turtle.forward()
  25.         turtle.placeUp()
  26.         count = count - 1
  27.     end
  28. end
  29.  
  30. turtle.refuel()
  31. if turtle.forward() then
  32.     broadcast("Turtle undocked")
  33. else
  34.     broadcast("Turtle encountered an obstacle")
  35. end
  36. turtle.forward()
  37. turtle.turnRight()
  38.  
  39. while not turtle.detect() do
  40.     turtle.forward()
  41. end
  42.  
  43. turtle.up()
  44. turtle.up()
  45. turtle.turnLeft()
  46. turtle.placeUp()
  47. broadcast("Silo closing")
  48. oneLine()
  49. turtle.turnLeft()
  50. oneLine()
  51. turtle.turnLeft()
  52. oneLine()
  53. turtle.turnLeft()
  54. placeCount(5)
  55. turtle.turnLeft()
  56. placeCount(5)
  57. turtle.turnLeft()
  58. placeCount(4)
  59. turtle.turnLeft()
  60. placeCount(4)
  61. turtle.turnLeft()
  62. placeCount(3)
  63. turtle.turnLeft()
  64. placeCount(3)
  65. turtle.turnLeft()
  66. placeCount(2)
  67. turtle.turnLeft()
  68. placeCount(2)
  69. turtle.turnLeft()
  70. placeCount(1)
  71. turtle.turnLeft()
  72. placeCount(1)
  73. turtle.turnLeft()
  74. turtle.turnLeft()
  75. placeCount(3)
  76. turtle.down()
  77. turtle.down()
  78. turtle.forward()
  79. turtle.forward()
  80. turtle.turnLeft()
  81. turtle.turnLeft()
  82.  
  83. broadcast("Rocket Silo closed successfully")
  84.  
  85. rednet.close("right")
RAW Paste Data