Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- local mon = peripheral.wrap("monitor_0")
- local reactor1 = peripheral.wrap("BigReactors-Reactor_1")
- local reactor2 = peripheral.wrap("BigReactors-Reactor_2")
- local bank = peripheral.wrap("tile_blockcapacitorbank_name_1")
- local high = 1700000000
- local low = 900000000
- local bankstorage = bank.getEnergyStored()
- local reactorenergy1 = reactor1.getEnergyProducedLastTick()
- local reactorenergy2 = reactor2.getEnergyProducedLastTick()
- local fuelused1 = reactor1.getFuelConsumedLastTick()
- local fuelused2 = reactor2.getFuelConsumedLastTick()
- local rod1 = reactor1.getControlRodLevel(1)
- local rod2 = reactor2.getControlRodLevel(2)
- local fuelamount = reactor1.getFuelAmount()
- local fuelamount2 = reactor2.getFuelAmount()
- local fuelamountmax = reactor1.getFuelAmountMax()
- local fuelamountmax2 = reactor2.getFuelAmountMax()
- local numCapacitors = 72
- mon.clear()
- mon.setTextScale(2)
- mon.setTextColor(colors.yellow)
- mon.setCursorPos(1,3)
- mon.write("--------------------------------")
- --reactor1
- mon.setCursorPos(8,1)
- mon.setTextColor(colors.purple)
- mon.write("Reactor1")
- mon.setCursorPos(8,2)
- if reactor1.getActive(true) then
- mon.setTextColor(colors.lime)
- mon.write("Online") else
- mon.setTextColor(colors.red)
- mon.write("Offline")
- end
- --reactor2
- mon.setCursorPos(21,1)
- mon.setTextColor(colors.purple)
- mon.write("Reactor2")
- mon.setCursorPos(21,2)
- if reactor2.getActive(true) then
- mon.setTextColor(colors.lime)
- mon.write("Online") else
- mon.setTextColor(colors.red)
- mon.write("Offline")
- end
- --RF/t
- --reactor1
- mon.setCursorPos(1,4)
- mon.setTextColor(colors.orange)
- mon.write("RF/T:")
- mon.setCursorPos(8,4)
- mon.setTextColor(colors.cyan)
- mon.write(comma_value(reactorenergy1))
- --reactor2
- mon.setCursorPos(21,4)
- mon.setTextColor(colors.cyan)
- mon.write(comma_value(reactorenergy2))
- --Both reactors Total rf/t
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.orange)
- mon.write("Total:")
- mon.setCursorPos(8,5)
- mon.setTextColor(colors.cyan)
- mon.write(comma_value(reactorenergy1+reactorenergy2))
- --------------------------------------------------
- --bankTotal%
- mon.setCursorPos(1,9)
- mon.setTextColor(colors.orange)
- mon.write("RF:")
- mon.setCursorPos(8,9)
- mon.setTextColor(colors.cyan)
- bankstoragepercent = math.floor((bankstorage/bank.getMaxEnergyStored())*100)
- mon.write(bankstoragepercent.."%")
- --bankTotal
- mon.setCursorPos(14,9)
- mon.setTextColor(colors.cyan)
- mon.write(comma_value(bankstorage*numCapacitors))
- ----------------------------------------------
- --reactor fuel amount
- --reactor1
- mon.setCursorPos(1,6)
- mon.setTextColor(colors.orange)
- mon.write("Fuel:")
- mon.setCursorPos(8,6)
- mon.setTextColor(colors.cyan)
- fuelpercentage = math.floor((fuelamount/fuelamountmax)*100)
- mon.write(fuelpercentage.."%")
- --reactor2
- mon.setCursorPos(21,6)
- mon.setTextColor(colors.cyan)
- fuelpercentage = math.floor((fuelamount2/fuelamountmax2)*100)
- mon.write(fuelpercentage.."%")
- --------------------------------------------
- --reactor rod%
- --reactor1
- mon.setCursorPos(1,7)
- mon.setTextColor(colors.orange)
- mon.write("Rod%:")
- mon.setCursorPos(8,7)
- mon.setTextColor(colors.cyan)
- rodpercentage = math.floor((rod1/100)*100)
- mon.write(rodpercentage.."%")
- --reactor2
- mon.setCursorPos(21,7)
- mon.setTextColor(colors.cyan)
- rodpercentage = math.floor((rod2/100)*100)
- mon.write(rodpercentage.."%")
- ---------------------------------------------
- --reactor fuel used/t
- --reactor1
- mon.setCursorPos(1,8)
- mon.setTextColor(colors.orange)
- mon.write("Used/T:")
- mon.setCursorPos(8,8)
- fuelused = math.floor(fuelused1*100)
- fuelused = fuelused/100
- mon.setTextColor(colors.cyan)
- mon.write(fuelused)
- --reactor2
- mon.setCursorPos(21,8)
- mon.setTextColor(colors.cyan)
- fuelused = math.floor(fuelused2*100)
- fuelused = fuelused2/100
- mon.write(fuelused)
- ------------------------------------------
- --function reactor control rod levels
- --reactor1
- if bankstorage*numCapacitors <= low then
- reactor1.setAllControlRodLevels(0)
- end
- if bankstorage*numCapacitors >= high then
- reactor1.setAllControlRodLevels(100)
- end
- --reactor2
- if bankstorage*numCapacitors <= low then
- reactor2.setAllControlRodLevels(0)
- end
- if bankstorage*numCapacitors >= high then
- reactor2.setAllControlRodLevels(100)
- end
- function comma_value(amount)
- local formatted = amount
- local swap = false
- if formatted < 0 then
- formatted = formatted*-1
- swap = true
- end
- while true do
- formatted, k = string.gsub(formatted, "^(%d+)(%d%d%d)", '%1,%2')
- if k == 0 then
- break
- end
- end
- if swap then
- formatted = "-"..formatted
- end
- return formatted
- end
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement