Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- Project: ComputCraft controlling Big Reactor
- -- Version: 1.9
- -- Description:
- --
- -- Managed by MikeyLikeyMC
- -- Tutorials available here: http://bit.ly/1IgK6cA
- --
- -- Copyright 2015 . All Rights Reserved.
- --
- print('Welcome to IGN Power Control...')
- print('')
- sleep(0.5)
- print('Brought to you by: MikeyLikeyMC')
- print('')
- sleep(0.5)
- print('Please wait ...')
- print('')
- sleep(1)
- print('ReactorControl has been Engaged.')
- print('Please view main Monitor.')
- print('')
- -- Peripheral Locations
- reactor=peripheral.wrap('back')
- monitor=peripheral.wrap('top')
- -- Reactor Variables
- emptyflag=0
- offlineflag=0
- -- Flashing Message
- -- Will also need to unmute other lines of code in the warning area to re-enable
- -- flashflag=0 -- Muted to prevent the flashing
- -- Formating Variables
- newSection = 2 -- AKA Double Space
- nextLine = 1
- cellA = 0 -- Can be used to ensure a border
- cellB = 3 -- Can be used to indent information for easy readability
- cellC = 12 -- Data lined up with center of 3 x 4 monitor
- -- Definable Colors
- background = (colors.black) -- Monitor Background
- sectionHeader = (colors.white) -- Monitor Colors
- header = (colors.white)
- -- Temperatures
- fuel = (colors.yellow)
- waste = (colors.cyan)
- producing = (colors.green) -- Amount of power being produced (reference: RF)
- casing = (colors.lightGray)
- steam = (colors.blue)
- safe = (colors.green)
- neutral = (colors.orange)
- danger = (colors.red)
- credits = (colors.cyan)
- -- Automation Formatting & Messages (These Override the Definable Colors above)
- fManualOverride = (colors.lightGray)
- mManualOverride = (' OFFLINE (Manual Override)')
- -- Simplified: OFFLINE: Manual Override
- fFuelExhausted = (colors.pink)
- mManualOverride = (' OFFLINE (Fuel Exhausted)')
- -- Simplified: OFFLINE: Fuel Exhausted
- fLowPowerMode = (colors.purple)
- mLowPowerMode = (' ONLINE (Low Power Mode)')
- -- Simplified: ONLINE: Low Power Mode
- fHighPowerMode = (colors.orange)
- mHighPowerMode = (' ONLINE (High Power Mode)')
- -- Simplified: ONLINE: High Power Mode
- -- Peripheral Locations
- reactor=peripheral.wrap('back')
- monitor=peripheral.wrap('top')
- monitor.setTextScale(1)
- monitor.setBackgroundColor(background)
- while true do
- -- Refreshes the screen and resets the cursor positions to their defaults
- x=1
- y=1
- monitor.clear()
- monitor.setCursorPos(x+cellA,y)
- monitor.setTextColor(header)
- monitor.write('Fuel Level:')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fuel)
- monitor.write(math.floor(((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Fuel')
- -- No increment to y (same line)
- monitor.setCursorPos(x+cellC,y)
- monitor.setTextColor(waste)
- monitor.write(math.floor(((reactor.getWasteAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Waste')
- y=y+newSection
- monitor.setCursorPos(x,y)
- monitor.setTextColor(header)
- monitor.write('Control Rod Levels (TBS):')
- monitor.setTextColor(neutral)
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.write(' Rod 1: '..(100-(reactor.getControlRodLevel(0)))..'% Depth')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.write(' Rod 2: '..(100-(reactor.getControlRodLevel(1)))..'% Depth')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.write(' Rod 3: '..(100-(reactor.getControlRodLevel(2)))..'% Depth')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.write(' Rod 4: '..(100-(reactor.getControlRodLevel(3)))..'% Depth')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.write(' Rod 5: '..(100-(reactor.getControlRodLevel(4)))..'% Depth')
- y=y+newSection
- monitor.setCursorPos(x+cellA,y)
- monitor.setTextColor(sectionHeader)
- monitor.write('Temperature:')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(casing)
- monitor.write(' Casing: ')
- if reactor.getCasingTemperature()>=650 then
- monitor.setTextColor(neutral)
- else if reactor.getCasingTemperature()>=950 then
- monitor.setTextColor(danger)
- else
- monitor.setTextColor(safe)
- end
- end
- monitor.setCursorPos(x+cellC,y)
- monitor.write(reactor.getCasingTemperature()..'C')
- y=y+1
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fuel)
- monitor.write(' Fuel: ')
- if reactor.getFuelTemperature()>=650 then
- monitor.setTextColor(neutral)
- else if reactor.getFuelTemperature()>=950 then
- monitor.setTextColor(danger)
- else
- monitor.setTextColor(safe)
- end
- end
- monitor.setCursorPos(x+cellC,y)
- monitor.write(reactor.getFuelTemperature()..'C')
- y=y+newSection
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(header)
- monitor.write(' Flux:')
- --Same Line
- monitor.setCursorPos(x+cellC,y) -- if re-enabled a new cell may need to be defined
- monitor.setTextColor(safe)
- monitor.write(reactor.getEnergyStored()..' RF Stored')
- y=y+newSection
- monitor.setCursorPos(x+cellA,y)
- monitor.setTextColor(header)
- monitor.write(' Producing: ')
- --Same Line
- -- monitor.setCursorPos(x+cellC,y)
- monitor.setTextColor(safe)
- if reactor.getEnergyProducedLastTick()>=500 and reactor.getEnergyProducedLastTick()<2000 then
- monitor.setTextColor(neutral)
- end
- if reactor.getEnergyProducedLastTick()>=2000 then
- monitor.setTextColor(danger)
- end
- monitor.setTextColor(producing)
- monitor.write((math.floor(reactor.getEnergyProducedLastTick()+0.5))..' RF/t')
- y=y+newSection
- monitor.setCursorPos(x+cellA,y)
- monitor.setTextColor(sectionHeader)
- monitor.write('Automation:')
- --if flashflag==0 then
- -- flashflag=1
- y=y+1
- if offlineflag==1 then
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fManualOverride) -- Default: lightGray
- monitor.write(mManualOverride)
- end
- if emptyflag==1 then
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fFuelExhausted) -- Default: pink
- monitor.write(mFuelExhausted)
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)>75 then
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fLowPowerMode) -- Default: purple
- monitor.write(mLowPowerMode)
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)<=75 then
- monitor.setCursorPos(x+cellB,y)
- monitor.setTextColor(fHighPowerMode)
- monitor.write(mHighPowerMode)
- end
- --else
- -- flashflag=0
- -- monitor.setCursorPos(1,23) --- Is this line necessary if not using Flashing?
- -- monitor.clearLine()
- --end
- -- *****************************************
- -- * *
- -- * Out of respect for the coder please *
- -- * do not change the following credits *
- -- * *
- -- *****************************************
- y=y+newSection
- monitor.setCursorPos(x+cellA+2,25)
- monitor.setTextColor(header)
- monitor.write('Your IT Specialist:')
- y=y+1
- monitor.setCursorPos(x+15,26) -- Indentation
- monitor.setTextColor(credits)
- monitor.write('MikeyLikeyMC')
- 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
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement