View difference between Paste ID: EDXZL1CY and 8nB04EDm
SHOW: | | - or go back to the newest paste.
1-
--[[Spectrolus Generator
1+
	--[[Spectrolus Generator
2
By PancakePhD
3
4-
Do not redistribute. Contact Pancake]]--
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-
            turtle.dropDown(1)
13+
Wool Order:
14-
            --Uncomment this is your spreaders are overloaded \/
14+
1.White 2.Orange 3.Magenta 4.Light Blue
15-
            os.sleep(7)
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-
    woolValid = true
26+
27
dropDelay = 3
28-
	print("Validating Wool")
28+
timeAfterCycle = 5
29
30-
		--For some reason white wool's damage is 64, whereas the rest are sequential....
30+
color = {
31-
		if (turtle.getItemDetail(i).damage ~= i - 1 or turtle.getItemCount(i) < 2) then
31+
	"white",
32
	"orange",
33
	"magenta",
34-
			print("Wool invalid at index: "..i)
34+
	"light_blue",
35-
    os.setComputerLabel("Wool Invalid")
35+
	"yellow",
36
	"lime",
37
	"pink",
38
	"gray",
39-
    if woolValid then
39+
	"light_gray",
40-
        print("Your wool's valid. Flip the lever to start the drop.")
40+
	"cyan",
41-
        os.setComputerLabel("Flip Lever")
41+
	"purple",
42-
	    while woolValid do
42+
	"blue",
43-
	        if rs.getInput("top") then
43+
	"brown",
44-
             os.setComputerLabel("Running")
44+
	"green",
45
	"red",
46
	"black"
47
}
48-
    	    sleep(.1)
48+
49
local function dropWool()
50-
    end
50+
51
        if woolValid and turtle.getItemCount(i) > 1 then
52-
	sleep(1)
52+
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