Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor = peripheral.wrap("BigReactors-Reactor_0")
- checks = 0
- check = {}
- avg = "Not Determined"
- wastedNRG = 0
- forceTog = false
- while true do
- parallel.waitForAny(function()
- while true do
- if checks < 3 then
- table.insert(check,reactor.getEnergyProducedLastTick())
- checks = checks + 1
- else
- avg = tostring((check[1] + check[2] + check[3]) / 3)
- checks = 0
- check = {}
- end
- sleep(0)
- term.setBackgroundColor(colors.purple)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- write("Is active?: ")
- if reactor.getActive() == true then
- term.setTextColor(colors.lime)
- elseif reactor.getActive() == false then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.blue)
- end
- print(tostring(reactor.getActive()))
- term.setTextColor(colors.black)
- write("Energy In Buffer: "..tostring(reactor.getEnergyStored()).."RF/10000000RF "..string.sub(tostring((reactor.getEnergyStored()/10000000) * 100),1,string.find((reactor.getEnergyStored() / 10000000) * 100, ".") + 3).."%")
- paintutils.drawLine(1,3,10,3,colors.brown)
- paintutils.drawLine(0,3,(reactor.getEnergyStored() / 10000000)*10,3,colors.red)
- term.setCursorPos(1,4)
- term.setBackgroundColor(colors.purple)
- print("Fuel: "..tostring(reactor.getFuelAmount()).."/"..tostring(reactor.getFuelAmountMax()).."mB "..tostring((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100).."%")
- paintutils.drawLine(1,5,10,5,colors.black)
- paintutils.drawLine((reactor.getFuelAmount() / reactor.getFuelAmountMax()) * 10,5,((reactor.getFuelAmount() / reactor.getFuelAmountMax())*10)+((reactor.getWasteAmount() / reactor.getFuelAmountMax())*10),5,colors.blue)
- paintutils.drawLine(0,5,(reactor.getFuelAmount() / reactor.getFuelAmountMax()) * 10,5,colors.yellow)
- term.setBackgroundColor(colors.purple)
- term.setCursorPos(1,6)
- print("Average RF/t: "..avg)
- if forceTog == false then
- if reactor.getEnergyStored() >= 9000000 then
- forceTog = true
- reactor.setActive(false)
- else
- forceTog = false
- reactor.setActive(true)
- end
- end
- if reactor.getEnergyStored() == 10000000 then
- wastedNRG = wastedNRG + reactor.getEnergyProducedLastTick()
- end
- print("Energy wasted: "..wastedNRG.."RF")
- paintutils.drawLine(29,5,29,7,colors.blue)
- paintutils.drawLine(30,8,32,8,colors.blue)
- paintutils.drawLine(33,7,33,5,colors.blue)
- paintutils.drawLine(31,6,31,4,colors.blue)
- term.setCursorPos(29,9)
- term.setBackgroundColor(colors.purple)
- print("Manual Toggle: "..tostring(forceTog))
- if forceTog == true then
- paintutils.drawPixel(29,10,colors.lime)
- else
- paintutils.drawPixel(29,10,colors.red)
- end
- if reactor.getWasteAmount() >= 1000 then
- reactor.doEjectWaste()
- end
- end
- end, function()
- while true do
- sleep(0)
- local event, button, x, y = os.pullEvent()
- if event == "mouse_click" then
- if button == 1 then
- if y >= 4 and y <= 8 and x >= 29 and x <= 33 then
- if forceTog == true then
- if reactor.getActive() == true then
- reactor.setActive(false)
- else
- reactor.setActive(true)
- end
- end
- break
- elseif y == 10 and x == 29 then
- if forceTog == false then
- forceTog = true
- else
- forceTog = false
- end
- break
- end
- end
- elseif event == "monitor_touch" then
- if y >= 4 and y <=8 and x >= 29 and x <= 33 then
- if reactor.getActive() == true then
- reactor.setActive(false)
- elseif reactor.getActive() == false then
- reactor.setActive(true)
- end
- break
- elseif y == 10 and x == 29 then
- if forceTog == true then
- forceTog = false
- else
- forceTog = true
- end
- break
- end
- end
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement