Advertisement
Spiker985

FTB - Growth Accelerator x6 Control

Jan 11th, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | None | 0 0
  1. --[[This uses a turtle to break and replace the cable and growth accelerator
  2. for the most part, this is useless to someone who doesn't know the proper format for the blocks/cables
  3.  
  4. CCC
  5. C AT
  6. CAWA
  7.   A
  8.  
  9. T = Turtle w/ pickaxe
  10. A = Accelerator
  11. C = Fluix cable
  12. W = Water
  13.  
  14. That is the side view of the format you must have, if you want to redstone control it,
  15. it uses the bottom to control the rs signal]]--
  16.  
  17. local interval = 60  --Interval to wait in seconds, 60 works fine
  18. local fluixInterval = 10  --Interval to wait for fluix crystals, required components go in slots 14, 15, and 16
  19. local seed = 1  --Slot the seeds will be in
  20. local cable = 2  --Slot the fluix cable with be in
  21. local accel = 3  --Slot the Crystal Growth Accelerator will be in
  22. local output = 4  --Output slot
  23. local message = "seed"  --Required message to start the "seed" process
  24. local message2 = "fluix"  --Required message to start the "fluix" process
  25. local storage = "Left"  --Storage if you desire to have it, also the required message to start the "store" process
  26.  
  27. --[[Do not edit anything below this]]--
  28.  
  29. if peripheral.getType("right") == "modem" then rednet.open("right") end
  30. if peripheral.getType("left") == "modem" then rednet.open("left") end
  31.  
  32.  
  33. function create()
  34.   turtle.select(seed)
  35.   turtle.dropDown()
  36. end
  37.  
  38. function replace()
  39.   turtle.up()
  40.   turtle.select(accel)
  41.   turtle.placeDown()
  42.   turtle.back()
  43.   turtle.select(cable)
  44.   turtle.place()
  45. end
  46.  
  47. function pickup()
  48.   turtle.select(cable)
  49.   turtle.dig()
  50.   turtle.suck()
  51.   turtle.forward()
  52.   turtle.select(accel)
  53.   turtle.digDown()
  54.   turtle.down()
  55.   turtle.select(output)
  56.   turtle.suckDown()
  57.   turtle.up()
  58. end
  59.  
  60. if rednet.isOpen("right") or rednet.isOpen("left") then print("Waiting for message") senderID, msg = rednet.receive() end
  61.  
  62. if msg == message then
  63.   print("Message received: "..msg)
  64.   create()
  65.   replace()
  66.   rs.setOutput("bottom", true)
  67.   print("Waiting for "..interval.." seconds")
  68.   for i = 1, interval do
  69.     print(i)
  70.     sleep(1)
  71.   end
  72.   rs.setOutput("bottom", false)
  73.   pickup()
  74. end
  75.  
  76. if msg == "storeLeft" then
  77.   print("Message received: "..msg)
  78.   turtle.turnLeft()
  79.   for i = 1, 16 do
  80.     turtle.select(i)
  81.     turtle.drop()
  82.   end
  83.   turtle.turnRight()
  84. end
  85. if msg == "storeRight" then
  86.   print("Message received: "..msg)
  87.   turtle.turnRight()
  88.   for i = 1, 16 do
  89.     turtle.select(i)
  90.     turtle.drop()
  91.   end
  92.   turtle.turnLeft()
  93. end
  94.  
  95. if msg == "retrieveLeft" then
  96.   print("Message received: "..msg)
  97.   turtle.turnLeft()
  98.   for i = 1, 16 do
  99.     turtle.select(i)
  100.     turtle.suck()
  101.   end
  102.   if turtle.getItemCount(3) == 0 then
  103.     turtle.select(2)
  104.     turtle.transferTo(3)
  105.     turtle.select(1)
  106.     turtle.transferTo(2)
  107.   end
  108.   turtle.turnRight()
  109. end
  110.  
  111. if msg == "retrieveRight" then
  112.   print("Message received: "..msg)
  113.   turtle.turnRight()
  114.   for i = 1, 16 do
  115.     turtle.select(i)
  116.     turtle.suck()
  117.   end
  118.   if turtle.getItemCount(3) == 0 then
  119.     turtle.select(2)
  120.     turtle.transferTo(3)
  121.     turtle.select(1)
  122.     turtle.transferTo(2)
  123.   end
  124.   turtle.turnleft()
  125. end
  126.  
  127. if msg == message2 then
  128.   print("Message received: "..msg)
  129.   turtle.select(14)
  130.   turtle.dropDown()
  131.   turtle.select(15)
  132.   turtle.dropDown()
  133.   turtle.select(16)
  134.   turtle.dropDown()
  135.   turtle.down()
  136.   sleep(fluixInterval)
  137.   turtle.select(14)
  138.   turtle.suckDown()
  139.   turtle.select(15)
  140.   turtle.suckDown()
  141.   turtle.select(16)
  142.   turtle.suckDown()
  143.   turtle.up()
  144. end
  145.  
  146. rednet.broadcast("fuel: "..turtle.getFuelLevel())
  147. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement