Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.find("monitor")
- monX, monY = mon.getSize()
- reactor = peripheral.find("BigReactors-Reactor")
- running = true
- sumSelect = true
- auto = false
- while running == true do
- reactorInfo = {
- active = reactor.getActive(),
- power = reactor.getEnergyStored(),
- ftemp = reactor.getFuelTemperature(),
- ctemp = reactor.getCasingTemperature(),
- fuel = reactor.getFuelAmount(),
- waste = reactor.getWasteAmount(),
- fuelMax = reactor.getFuelAmountMax(),
- powerPerTick = reactor.getEnergyProducedLastTick(),
- reactivity = reactor.getFuelReactivity()
- }
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.setCursorPos(1, 1)
- mon.clear()
- function flip()
- if mon.getBackgroundColor() == colors.blue then
- mon.setBackgroundColor(colors.green)
- elseif mon.getBackgroundColor() == colors.green then
- mon.setBackgroundColor(colors.blue)
- else
- mon.setBackgroundColor(colors.blue)
- end
- end
- function newLine()
- tempX, tempY = mon.getCursorPos()
- mon.setCursorPos(1, tempY + 1)
- end
- if sumSelect == true then
- per = reactorInfo.power / 10000000
- elseif sumSelect == false then
- per = reactorInfo.fuel / reactorInfo.fuelMax
- end
- if auto then
- per2 = reactorInfo.power / 10000000
- if per2 <= 0.2 then
- reactor.setActive(true)
- elseif per2 >= 0.5 then
- reactor.setActive(false)
- end
- end
- toTen = 1
- if per < 0.15 then
- toTen = 1
- elseif per < 0.25 and per >= 0.15 then
- toTen = 2
- elseif per < 0.35 and per >= 0.25 then
- toTen = 3
- elseif per < 0.45 and per >= 0.35 then
- toTen = 4
- elseif per < 0.55 and per >= 0.45 then
- toTen = 5
- elseif per < 0.65 and per >= 0.55 then
- toTen = 6
- elseif per < 0.75 and per >= 0.65 then
- toTen = 7
- elseif per < 0.85 and per >= 0.75 then
- toTen = 8
- elseif per < 0.95 and per >= 0.85 then
- toTen = 9
- elseif per >= 0.95 then
- toTen = 10
- end
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(1, monY)
- mon.write("Summary: ")
- if sumSelect == true then
- mon.setBackgroundColor(colors.green)
- mon.write(string.rep(" ", toTen))
- mon.setBackgroundColor(colors.red)
- mon.write(string.rep(" ", 10 - toTen))
- elseif sumSelect == false then
- mon.setBackgroundColor(colors.yellow)
- mon.write(string.rep(" ", toTen))
- mon.setBackgroundColor(colors.gray)
- mon.write(string.rep(" ", 10 - toTen))
- end
- mon.setCursorPos(monX - 3, monY)
- mon.setBackgroundColor(colors.green)
- mon.write("()")
- mon.setCursorPos(1, 1)
- flip()
- mon.write("Reactor Active: "..tostring(reactorInfo.active))
- flip()
- newLine()
- mon.write("Power Level: "..reactorInfo.power.."/1000000")
- flip()
- newLine()
- mon.write("Fuel Level: "..reactorInfo.fuel.."/"..reactorInfo.fuelMax)
- flip()
- newLine()
- mon.write("Waste Level: "..reactorInfo.waste)
- flip()
- newLine()
- mon.write("Casing Temperature: "..reactorInfo.ctemp)
- flip()
- newLine()
- mon.write("Fuel Temperature: "..reactorInfo.ftemp)
- text = "Toggle Power"
- newX, newY = 1
- newX = math.ceil((monX - string.len(text)) / 2)
- newY = math.ceil((monY - 1) / 2 + 3)
- if reactorInfo.active and not auto then
- mon.setBackgroundColor(colors.green)
- elseif not reactorInfo.active then
- mon.setBackgroundColor(colors.red)
- elseif reactorInfo.active and auto then
- mon.setBackgroundColor(colors.blue)
- end
- mon.setCursorPos(newX, newY)
- mon.write(text)
- tempXX, tempYY = mon.getCursorPos()
- mon.setCursorPos(tempXX + 2, tempYY)
- if auto then
- mon.setBackgroundColor(colors.blue)
- else
- mon.setBackgroundColor(colors.gray)
- end
- mon.write("Auto")
- mon.setBackgroundColor(colors.black)
- timer = os.startTimer(3)
- event = {os.pullEvent()}
- if event[1] == "monitor_touch" then
- if (event[3] == monX - 3 or event[3] == monX - 2) and event[4] == monY then
- sumSelect = not sumSelect
- elseif event[3] >= newX and event[3] < newX + #text and event[4] == newY then
- reactor.setActive(not reactorInfo.active)
- elseif event[3] >= tempXX + 2 and event[3] < tempXX + 6 and event[4] == newY then
- auto = not auto
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement