Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = peripheral.wrap("back")
- local display = peripheral.wrap("right")
- local tanks = {
- coolantA1 = "rcirontankvalvetile_2",
- coolantB1 = "rcirontankvalvetile_3",
- coolantS = "rcirontankvaluetile_4",
- distilledA1 = "rcirontankvalvetile_5",
- distilledB1 = "rcirontankvalvetile_1",
- distilledS = "rcirontankvaluetile_6"
- }
- function tryTankLevel(tank)
- return com.callRemote(tank, "getTankInfo")[1].contents.amount
- end
- function getTankLevel(tank)
- local empty, level = pcall(tryTankLevel, tank)
- if (not empty) then
- return 0
- else
- return level
- end
- end
- local colorValue = 0
- function toggleColor(color)
- if (rs.testBundledInput("bottom", color)) then
- rs.setBundledOutput("bottom", colorValue - color)
- colorValue = colorValue - color
- else
- rs.setBundledOutput("bottom", colorValue + color)
- colorValue = colorValue + color
- end
- end
- function printAtMonitor(x, y, color, text)
- display.setTextColor(color)
- display.setCursorPos(x, y)
- display.write(text)
- end
- function printAt(x,y,color,text)
- term.setTextColor(color)
- term.setCursorPos(x, y)
- term.write(text)
- end
- function signalToColor(signal)
- if (signal) then
- return colors.lime
- else
- return colors.red
- end
- function reactorDisplay()
- local run = true
- while true do
- local coolant = {
- tankA1 = getTankLevel(tanks.coolantA1),
- tankB1 = getTankLevel(tanks.coolantB1),
- tankA2 = 0,
- tankB2 = 0,
- tankA3 = 0,
- tankB3 = 0,
- tankA4 = 0,
- tankB4 = 0,
- tankS = getTankLevel(tanks.coolantS),
- SA1 = rs.testBundledInput("bottom", 1),
- A1A2 = rs.testBundledInput("bottom", 2),
- A2A3 = rs.testBundledInput("bottom", 4),
- A3A4 = rs.testBundledInput("bottom", 8),
- A4S = rs.testBundledInput("bottom", 16),
- SB1 = rs.testBundledInput("bottom", 32),
- B1B2 = rs.testBundledInput("bottom", 64),
- B2B3 = rs.testBundledInput("bottom", 128),
- B3B4 = rs.testBundledInput("bottom", 256),
- B4S = rs.testBundledInput("bottom", 512)
- }
- local distilled = {
- tankA1 = getTankLevel(tanks.distilledA1),
- tankB1 = getTankLevel(tanks.distilledB1),
- tankA2 = 0,
- tankB2 = 0,
- tankA3 = 0,
- tankB3 = 0,
- tankA4 = 0,
- tankB4 = 0,
- tankS = getTankLevel(tanks.distilledS),
- SA1 = rs.testBundledInput("top", 1),
- A1A2 = rs.testBundledInput("top", 2),
- A2A3 = rs.testBundledInput("top", 4),
- A3A4 = rs.testBundledInput("top", 8),
- A4S = rs.testBundledInput("top", 16),
- SB1 = rs.testBundledInput("top", 32),
- B1B2 = rs.testBundledInput("top", 64),
- B2B3 = rs.testBundledInput("top", 128),
- B3B4 = rs.testBundledInput("top", 256),
- B4S = rs.testBundledInput("top", 512)
- }
- display.clear()
- printAtMonitor(1,1,colors.white,"Coolant:")
- printAtMonitor(2,2,colors.cyan, "S: "..coolant.tankS)
- printAtMonitor(2,4,colors.cyan, "1A: "..coolant.tankA1)
- printAtMonitor(2,5,colors.cyan, "1B: "..coolant.tankB1)
- printAtMonitor(2,6,colors.cyan, "2A: "..coolant.tankA2)
- printAtMonitor(2,7,colors.cyan, "2B: "..coolant.tankB2)
- printAtMonitor(2,8,colors.cyan, "3A: "..coolant.tankA3)
- printAtMonitor(2,9,colors.cyan, "3B: "..coolant.tankB3)
- printAtMonitor(2,10,colors.cyan, "4A: "..coolant.tankA4)
- printAtMonitor(2,11,colors.cyan, "4B: "..coolant.tankB4)
- printAtMonitor(1,2,signalToColor(coolant.SA1), "v")
- printAtMonitor(1,3,signalToColor(coolant.SB1), "v")
- printAtMonitor(1,4,signalToColor(coolant.A1A2), "v")
- printAtMonitor(1,5,signalToColor(coolant.B1B2), "v")
- printAtMonitor(1,6,signalToColor(coolant.A2A3), "v")
- printAtMonitor(1,7,signalToColor(coolant.B2B3), "v")
- printAtMonitor(1,8,signalToColor(coolant.A3A4), "v")
- printAtMonitor(1,9,signalToColor(coolant.B3B4), "v")
- printAtMonitor(1,10,signalToColor(coolant.A4S), "^")
- printAtMonitor(1,11,signalToColor(coolant.B4S), "^")
- printAtMonitor(14,1,colors.white,"Distilled:")
- printAtMonitor(15,2,colors.lightBlue, "S: "..distilled.tankS)
- printAtMonitor(15,4,colors.lightBlue, "1A: "..distilled.tankA1)
- printAtMonitor(15,5,colors.lightBlue, "1B: "..distilled.tankB1)
- printAtMonitor(15,6,colors.lightBlue, "2A: "..distilled.tankA2)
- printAtMonitor(15,7,colors.lightBlue, "2B: "..distilled.tankB2)
- printAtMonitor(15,8,colors.lightBlue, "3A: "..distilled.tankA3)
- printAtMonitor(15,9,colors.lightBlue, "3B: "..distilled.tankB3)
- printAtMonitor(15,10,colors.lightBlue, "4A: "..distilled.tankA4)
- printAtMonitor(15,11,colors.lightBlue, "4B: "..distilled.tankB4)
- printAtMonitor(14,2,signalToColor(distilled.SA1), "v")
- printAtMonitor(14,3,signalToColor(distilled.SB1), "v")
- printAtMonitor(14,4,signalToColor(distilled.A1A2), "v")
- printAtMonitor(14,5,signalToColor(distilled.B1B2), "v")
- printAtMonitor(14,6,signalToColor(distilled.A2A3), "v")
- printAtMonitor(14,7,signalToColor(distilled.B2B3), "v")
- printAtMonitor(14,8,signalToColor(distilled.A3A4), "v")
- printAtMonitor(14,9,signalToColor(distilled.B3B4), "v")
- printAtMonitor(14,10,signalToColor(distilled.A4S), "^")
- printAtMonitor(14,11,signalToColor(distilled.B4S), "^")
- if (run) then
- printAtMonitor(1,12, colors.white, "Running")
- end
- run = not run
- sleep(1)
- end
- end
- reactorDisplay()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement