View difference between Paste ID: u7q6dAv6 and QQCgw1ZB
SHOW: | | - or go back to the newest paste.
1
local rside = "back"  --change this variable for the redstone connection
2
3
local d = peripheral.wrap("drum_0") --assumes 1 drum on the network
4
local tankInfo = d.getTankInfo()
5
local drum = tankInfo[1]
6
7
local cap = drum.capacity
8
local amount 
9
local mode = "essence"
10
11
redstone.setBundledOutput(rside, 0)
12
13
function addRS(color)
14
  redstone.setBundledOutput(rside,colors.combine(redstone.getBundledOutput(rside),color))
15
end
16
function removeRS(color)
17
  redstone.setBundledOutput(rside,colors.subtract(redstone.getBundledOutput(rside),color))
18
end
19
function testRS(color)
20
  bundle = redstone.getBundledOutput(rside)
21
  if colors.test(bundle,color) then
22
    return true
23
  else
24
    return false
25
  end
26
end
27
28
while true do
29-
--  print("Calculating")
29+
30-
--  read()
30+
31
  
32
  amount = drum.contents.amount
33
  if amount < cap then
34
    mode = "essence"
35
  else
36
    mode = "xp"
37
  end
38
  
39
  term.clear()
40
  term.setCursorPos(1,1)
41
  
42
  print("Mode: "..mode)
43
  print("Amount: "..amount)
44
  print("Capacity: "..cap)
45
  --print("Redstone Outputs:")
46
  --print("Red: "..redstone.getBundledOutput(rside, colors.red))
47
  --print("Blue: "..redstone.getBundledOutput(rside, color.blue))
48
  --print("Green: "..redstone.getBundledOutput(rside, color.green))
49
  
50
  if (mode=="essence") then    
51
    if testRS(colors.blue) then
52
      removeRS(colors.blue)
53-
  if (mode=="essence") then
53+
54-
--    print("Initiating essence kill")
54+
55-
--    read()
55+
56
    end
57
58
    sleep(1)
59
    
60
  elseif (mode=="xp") then
61
    if not testRS(colors.blue) then
62
      addRS(colors.blue)
63
    end
64-
--    print("Essence kill complete")
64+
65-
--    read()
65+
66
    end
67
    
68
    sleep(10)
69-
--    print("Initiating XP kill")
69+
70-
--    read()
70+
71
    addRS(colors.green)
72
    sleep(2)
73
    removeRS(colors.green)
74
    print("Killing Complete")
75
    sleep(1)
76
    
77
    print("Opening doors for next batch")
78
    removeRS(colors.red)
79
    sleep(2)
80
    addRS(colors.red)
81
    print("Doors closed")
82
    sleep(1)
83
84
  end
85
end