PancakePhD

Spectrolus Generator

Apr 10th, 2020 (edited)
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     --[[Spectrolus Generator
  2. By PancakePhD
  3.  
  4. Put a turtle over the Spectorlus and install this code to it.
  5. Then add the wool to the turtle in the specified order.
  6. You can feed wool directly to the turtle via pipes.
  7. Finally add a lever to the left or right of the turtle and flip it.
  8.  
  9. pastebin get EDXZL1CY startup
  10.  
  11. then hold down ctrl + r until the turtle reboots
  12.  
  13. Wool Order:
  14. 1.White 2.Orange 3.Magenta 4.Light Blue
  15. 5.Yellow 6.Lime 7.Pink 8.Grey
  16. 9.Light Grey 10.Cyan 11.Purple 12.Blue
  17. 13.Brown 14.Green 15.Red 16.Black
  18.  
  19. dropDelay = time between each color being dropped
  20. timeAfterCycle = time after the black wool is dropped.
  21.     Used as a mana buffer so your spreader and flowers
  22.     don't get overloaded
  23. ]]--
  24.  
  25. woolValid = true
  26. startPosition = 1
  27. dropDelay = 3
  28. timeAfterCycle = 5
  29.  
  30. color = {
  31.     "white",
  32.     "orange",
  33.     "magenta",
  34.     "light_blue",
  35.     "yellow",
  36.     "lime",
  37.     "pink",
  38.     "gray",
  39.     "light_gray",
  40.     "cyan",
  41.     "purple",
  42.     "blue",
  43.     "brown",
  44.     "green",
  45.     "red",
  46.     "black"
  47. }
  48.  
  49. local function dropWool()
  50.     for i=startPosition,16 do
  51.         if woolValid and turtle.getItemCount(i) > 1 then
  52.             turtle.select(i)
  53.            
  54.             for x=1,4 do
  55.                 turtle.drop(1)
  56.                 turtle.turnRight()
  57.             end
  58.             --[[for j=1,dropDelay do
  59.                 os.setComputerLabel("Waiting: "..(dropDelay - j))
  60.                 sleep(1)
  61.             end]]--
  62.         else
  63.             if woolValid then
  64.                 startPosition = i
  65.             end
  66.             woolValid = false
  67.         end
  68.     end
  69. end
  70.  
  71. local function isWoolValid()
  72.     woolValid = true
  73.  
  74.     for i=1,16 do
  75.         if (turtle.getItemDetail(i).name ~= "minecraft:"..color[i].."_wool" or turtle.getItemCount(i) < 5) then
  76.             woolValid = false
  77.             print("Slot: "..i.." should be "..color[i])
  78.  
  79.             task = null
  80.            
  81.             if (turtle.getItemDetail(i).name == "minecraft:"..color[i].."_wool") then
  82.                 retrieved = refinedstorage.extractItem({name="minecraft:"..color[i].."_wool"}, 63, "down")
  83.  
  84.                 if retrieved == nil then
  85.                     retrieved = 0
  86.                 end
  87.  
  88.                 if retrieved > 5 then
  89.                     woolValid = true
  90.                 end
  91.  
  92.                 task = refinedstorage.scheduleTask({name="minecraft:"..color[i].."_wool"}, 63 - retrieved)
  93.                 sleep(5)
  94.                 refinedstorage.extractItem({name="minecraft:"..color[i].."_wool"}, 63, "down")
  95.             else
  96.                 os.setComputerLabel("Wool Invalid")
  97.             end
  98.         end
  99.     end
  100.  
  101.     return woolValid
  102. end
  103.  
  104. local function main()
  105.         while isWoolValid() do
  106.             term.clear()
  107.             if rs.getInput("left") or rs.getInput("right") or rs.getInput("top") then
  108.                 os.setComputerLabel("Running")
  109.                 dropWool()
  110.              for i=1,timeAfterCycle do
  111.                  os.setComputerLabel("Sleeping: "..timeAfterCycle-i)
  112.                  sleep(1)
  113.              end
  114.             else
  115.                 os.setComputerLabel("Flip Lever to Start")
  116.             end
  117.         sleep(1)
  118.         end
  119. end
  120.  
  121. while true do
  122.     main()
  123. end
Add Comment
Please, Sign In to add comment