Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------
- -- Base monitoring Program --
- -------------------------------
- -- Designed/Coded By: audi9 --
- -------------------------------
- -- Version 0.1 --
- -------------------------------
- -- Changelog --
- -- ---------- --
- -- V0.1: The beginning! --
- -- - Started It! --
- -- - BigReactor Support --
- -- - Focusing on mon --
- -- buttons and such. --
- -- - BigReactor controls --
- -- itself via an API --
- -------------------------------
- -- Email Me for info at: --
- -- [email protected] --
- -------------------------------
- --/* This is reactor API */--
- -- House Keeping
- mon = peripheral.wrap('right')
- reactor = peripheral.wrap('BigReactors-Reactor_3')
- mon.clear()
- xPos, yPos = mon.getSize()
- emptyflag=0
- offlineflag=0
- flashflag=0
- local oldTime = os.time()
- local function sleepCheckin()
- local newTime = os.time()
- if newTime - oldTime >= (0.020 * 1.5) then
- oldTime = newTime
- sleep(10)
- end
- end
- end
- function Launch()
- mon.clear()
- while true do
- mon.setCursorPos(2,1)
- mon.setTextColor(colors.white)
- mon.write("Base Monitoring Program 0.1 (Alpha)")
- mon.setCursorPos(1,2)
- mon.write("--------------------------------------")
- mon.setCursorPos(1,3)
- mon.write("Home")
- mon.setCursorPos(6,3)
- mon.write(" > Power")
- mon.setCursorPos(2,5)
- mon.write("Fuel Level:")
- mon.setCursorPos(1,6)
- mon.write("----------------")
- mon.setCursorPos(1,7)
- mon.setTextColor(colors.yellow)
- mon.write(math.floor(((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100)+0.5).."% Fuel")
- mon.setCursorPos(1,8)
- mon.setTextColor(colors.lightBlue)
- mon.write(math.floor(((reactor.getWasteAmount()/reactor.getFuelAmountMax())*100)+0.5).."% Waste")
- mon.setCursorPos(2,10)
- mon.setTextColor(colors.white)
- mon.write("Control Rod Levels:")
- mon.setCursorPos(1,11)
- mon.write("---------------------")
- mon.setTextColor(colors.green)
- mon.setCursorPos(1,12)
- mon.write('Rod 1: '..(100-(reactor.getControlRodLevel(0)))..'% Depth')
- mon.setCursorPos(1,13)
- mon.write('Rod 2: '..(100-(reactor.getControlRodLevel(1)))..'% Depth')
- mon.setCursorPos(1,14)
- mon.write('Rod 3: '..(100-(reactor.getControlRodLevel(2)))..'% Depth')
- mon.setCursorPos(1,15)
- mon.write('Rod 4: '..(100-(reactor.getControlRodLevel(3)))..'% Depth')
- mon.setCursorPos(1,16)
- mon.write('Rod 5: '..(100-(reactor.getControlRodLevel(4)))..'% Depth')
- mon.setCursorPos(2,18)
- mon.setTextColor(colors.white)
- mon.write("Temperature:")
- mon.setCursorPos(1,19)
- mon.write("----------------")
- mon.setCursorPos(1,20)
- mon.setTextColor(colors.lightGray)
- mon.write('Casing: ')
- if reactor.getCasingTemperature()>=650 then
- mon.setTextColor(colors.purple)
- else if reactor.getCasingTemperature()>=950 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- end
- mon.write(reactor.getCasingTemperature()..'C')
- mon.setCursorPos(1,21)
- mon.setTextColor(colors.yellow)
- mon.write('Fuel: ')
- if reactor.getFuelTemperature()>=650 then
- mon.setTextColor(colors.purple)
- else if reactor.getFuelTemperature()>=950 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- end
- mon.write(reactor.getFuelTemperature()..'C')
- mon.setCursorPos(2,23)
- mon.setTextColor(colors.white)
- mon.write("Flux:")
- mon.setCursorPos(1,24)
- mon.write("----------------")
- mon.setTextColor(colors.green)
- mon.setCursorPos(1,25)
- mon.write(reactor.getEnergyStored()..' RF Stored ')
- if reactor.getEnergyProducedLastTick()>=500 and reactor.getEnergyProducedLastTick()<2000 then
- mon.setTextColor(colors.orange)
- end
- if reactor.getEnergyProducedLastTick()>=2000 then
- mon.setTextColor(colors.red)
- end
- mon.write((math.floor(reactor.getEnergyProducedLastTick()+0.5))..'RF/t')
- if flashflag==0 then
- flashflag=1
- if offlineflag==1 then
- mon.setCursorPos(1,27)
- mon.setTextColor(colors.lightGray)
- mon.write('OFFLINE - Manual Override')
- end
- if emptyflag==1 then
- mon.setCursorPos(1,27)
- mon.setTextColor(colors.pink)
- mon.write('OFFLINE - Fuel Exhausted')
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)>75 then
- mon.setCursorPos(1,27)
- mon.setTextColor(colors.yellow)
- mon.write('ONLINE - Low Power Mode')
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)<=75 then
- mon.setCursorPos(1,27)
- mon.setTextColor(colors.orange)
- mon.write('ONLINE - High Power Mode')
- end
- else
- flashflag=0
- mon.setCursorPos(1,27)
- mon.clearLine()
- end
- if reactor.getEnergyStored()<=10000000 and reactor.getEnergyStored()>100 then
- reactor.setAllControlRodLevels(0+(math.floor(reactor.getEnergyStored()/100000)))
- else
- reactor.setAllControlRodLevels(0)
- end
- if reactor.getFuelAmount()<=100 and offlineflag==0 then
- reactor.setAllControlRodLevels(100)
- reactor.setActive(false)
- emptyflag=1
- else
- emptyflag=0
- end
- if rs.getInput('bottom')==false and emptyflag==0 then
- reactor.setActive(true)
- offlineflag=0
- end
- if rs.getInput('bottom')==true and emptyflag==0 then
- reactor.setActive(false)
- reactor.setAllControlRodLevels(100)
- offlineflag=1
- end
- end
- else
- sleepCheckin()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment