Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --components
- local component = require("component")
- local event = require("event")
- local term = require("term")
- local fs = require("filesystem")
- local sides = require("sides")
- local colors = require("colors")
- local computer = require("computer")
- local gpu = component.gpu
- local reactor = component.reactor_chamber
- local rs = component.redstone
- local w,h = gpu.getResolution()
- --components
- --colors
- local black = 0x000000
- local red = 0xFF0000
- local yellow = 0xFFFF00
- local white = 0xffffff
- --colors
- --variables
- local color = red
- --variables
- --functions
- --centre text
- local function centerF(row, msg, ...)
- local mLen = string.len(msg)
- w, h = gpu.getResolution()
- term.setCursor((w - mLen)/2,row)
- print(msg:format(...))
- end
- --centre text
- --reactor status
- local function status()
- if reactor.getReactorEUOutput() == 0 then
- return "OffLine"
- else
- return "OnLine"
- end
- end
- --reactor status
- --reactor max heat
- local function maxHeat()
- max_heat = reactor.getMaxHeat() / 100
- max_heat_r = math.floor(max_heat + .5)
- return max_heat_r
- end
- --reactor max heat
- --reactor get heat
- local function getHeat()
- curr_heat = reactor.getHeat() / reactor.getMaxHeat() * 100
- curr_heat_r = math.floor(curr_heat + .5)
- return curr_heat_r
- end
- --reactor get heat
- --reactor EU
- local function getEU()
- euout = reactor.getReactorEUOutput()
- euout_r = math.floor(euout + .5)
- return euout_r
- end
- --reactor EU
- --measurements
- local function measurements()
- centerF(28, string.format("Reactor is: %s", status()))
- centerF(29, string.format("Reactor maxheat: %s", maxHeat()))
- centerF(30, string.format("Reactor heat: %s", getHeat()))
- centerF(31, string.format("Reactor EU Output: %s", getEU()))
- os.sleep(1)
- end
- --measurements
- --hazard
- local function hazard()
- term.clear()
- centerF(4, " -omNMy` `yNd+. ")
- centerF(5, " `+dNMMMMMh` `hMMMMNh/` ")
- centerF(6, " .smMMMMMMMMMd. .dMMMMMMMMmo` ")
- centerF(7, " .sNMMMMMMMMMMMMm- -mMMMMMMMMMMMmo` ")
- centerF(8, " `oNMMMMMMMMMMMMMMMN/ :mMMMMMMMMMMMMMMm+` ")
- centerF(9, " :dMMMMMMMMMMMMMMMMMMN+ /NMMMMMMMMMMMMMMMMMh- ")
- centerF(10, " `sNMMMMMMMMMMMMMMMMMMMMMo` +NMMMMMMMMMMMMMMMMMMMN+ ")
- centerF(11, " .hMMMMMMMMMMMMMMMMMMMMMMMMy` oNMMMMMMMMMMMMMMMMMMMMMMy` ")
- centerF(12, " -mMMMMMMMMMMMMMMMMMMMMMMMMMMh. `sMMMMMMMMMMMMMMMMMMMMMMMMMh. ")
- centerF(13, " -mMMMMMMMMMMMMMMMMMMMMMMMMMMMMd. `yMMMMMMMMMMMMMMMMMMMMMMMMMMMd. ")
- centerF(14, " .mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMm: `hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMh` ")
- centerF(15, " `dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN/ .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy ")
- centerF(16, " sMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN+ -dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM/ ")
- centerF(17, " -NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNh. ` .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMm` ")
- centerF(18, " yMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmo. `-+syhhhys/-` -sNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo ")
- centerF(19, " .NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMs. -smMMMMMMMMMMMdo. -hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMm` ")
- centerF(20, " oMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM+ `sMMMMMMMMMMMMMMMMNo sMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM: ")
- centerF(21, " hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo `dMMMMMMMMMMMMMMMMMMMy hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo ")
- centerF(22, " mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN` yMMMMMMMMMMMMMMMMMMMMM+ -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy ")
- centerF(23, " NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy `NMMMMMMMMMMMMMMMMMMMMMd mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd ")
- centerF(24, " +oooooooooooooooooooooooooooooo: `NMMMMMMMMMMMMMMMMMMMMMd ................................ ")
- centerF(25, " hMMMMMMMMMMMMMMMMMMMMMo ")
- centerF(26, " .mMMMMMMMMMMMMMMMMMMMh` ")
- centerF(27, " .hMMMMMMMMMMMMMMMMMs` ")
- centerF(28, " :hNMMMMMMMMMMMNy- ")
- centerF(29, " `/sydmmdhyo:` ")
- centerF(30, " //. ```` ./+ ")
- centerF(31, " `sMMNmhso+++oshmNMMy` ")
- centerF(32, " `yMMMMMMMMMMMMMMMMMMMy` ")
- centerF(33, " .dMMMMMMMMMMMMMMMMMMMMMh` ")
- centerF(34, " -mMMMMMMMMMMMMMMMMMMMMMMMd. ")
- centerF(35, " :NMMMMMMMMMMMMMMMMMMMMMMMMMd. ")
- centerF(36, " +NMMMMMMMMMMMMMMMMMMMMMMMMMMMm- ")
- centerF(37, " oNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN: ")
- centerF(38, " `sMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN/ ")
- centerF(39, " `hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN+ ")
- centerF(40, " .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM+ ")
- centerF(41, " -mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo ")
- centerF(42, " :NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMs` ")
- centerF(43, " +NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy` ")
- centerF(44, " `smNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNd: ")
- centerF(45, " -/ymNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNds/. ")
- centerF(46, " .:+shmNNMMMMMMMMMMMMMMMMMMMNNmhs/-` ")
- centerF(47, " `.:/++osyyyyyyyso+/:-.` ")
- gpu.setForeground(red)
- centerF(49, "IC2 Reactor Controller")
- centerF(50, "by red2211")
- os.sleep(2)
- end
- --hazard
- --main text
- local function main_text()
- term.clear()
- gpu.setForeground(white)
- centerF(11, "d888888b .o88b. .d888b. d8888b. d88888b .d8b. .o88b. d888888b .d88b. d8888b.")
- centerF(12, " `88' d8P Y8 VP `8D 88 `8D 88' d8' `8b d8P Y8 `~~88~~' .8P Y8. 88 `8D")
- centerF(13, " 88 8P odD' 88oobY' 88ooooo 88ooo88 8P 88 88 88 88oobY'")
- centerF(14, " 88 8b .88' 88`8b 88~~~~~ 88~~~88 8b 88 88 88 88`8b ")
- centerF(15, " .88. Y8b d8 j88. 88 `88. 88. 88 88 Y8b d8 88 `8b d8' 88 `88.")
- centerF(16, "Y888888P `Y88P' 888888D 88 YD Y88888P YP YP `Y88P' YP `Y88P' 88 YD")
- centerF(18, " .o88b. .d88b. d8b db d888888b d8888b. .d88b. db db d88888b d8888b.")
- centerF(19, "d8P Y8 .8P Y8. 888o 88 `~~88~~' 88 `8D .8P Y8. 88 88 88' 88 `8D")
- centerF(20, "8P 88 88 88V8o 88 88 88oobY' 88 88 88 88 88ooooo 88oobY'")
- centerF(21, "8b 88 88 88 V8o88 88 88`8b 88 88 88 88 88~~~~~ 88`8b ")
- centerF(22, "Y8b d8 `8b d8' 88 V888 88 88 `88. `8b d8' 88booo. 88booo. 88. 88 `88.")
- centerF(23, " `Y88P' `Y88P' VP V8P YP 88 YD `Y88P' Y88888P Y88888P Y88888P 88 YD")
- end
- --main text
- --warning_tr
- local function warning_tr()
- term.clear()
- gpu.setForeground(red)
- centerF(4, " `:oydddhs/` ")
- centerF(5, " `oNMMMMMMMMMMy ")
- centerF(6, " :NMMMms///ohMMMMo` ")
- centerF(7, " /MMMMo :mMMMh` ")
- centerF(8, " `oMMMN/ hMMMm. ")
- centerF(9, " `yMMMm: sMMMN: ")
- centerF(10, " .dMMMh +MMMM/ ")
- centerF(11, " mMMMy /NMMMo` ")
- centerF(12, " :NMMMo :mMMMy` ")
- centerF(13, " +MMMN+ dMMMd. ")
- centerF(14, " `sMMMm: yMMMm ")
- centerF(15, " `hMMMd oMMMN: ")
- centerF(16, " .mMMMh +NMMM+ ")
- centerF(17, " NMMMs /NMMMs` ")
- centerF(18, " /MMMM+ :mMMMy` ")
- centerF(19, " oMMMN/ hMMMd. ")
- centerF(20, " `yMMMm: yMMMm ")
- centerF(21, " `dMMMd oMMMN: ")
- centerF(22, " mMMMy +NMMM+ ")
- centerF(23, " :NMMMo /NMMMs` ")
- centerF(24, " +MMMN+ :mMMMh` ")
- centerF(25, " `sMMMm: hMMMd. ")
- centerF(26, " `hMMMd yMMMm ")
- centerF(27, " .dMMMh oMMMN: ")
- centerF(28, " NMMMs +NMMM+ ")
- centerF(29, " /NMMM+ /NMMMs` ")
- centerF(30, " oMMMN/ :mMMMh` ")
- centerF(31, " `yMMMm: hMMMd. ")
- centerF(32, " `hMMMd yMMMm ")
- centerF(33, " .mMMMy oMMMN: ")
- centerF(34, " :NMMMo +NMMM+ ")
- centerF(35, " /MMMN+ /NMMMs` ")
- centerF(36, " oMMMm: :mMMMy` ")
- centerF(37, " MMMN: hMMMh` ")
- centerF(38, " +MMMy dMMM/ ")
- centerF(39, " .NMMN/ hMMM+ ")
- centerF(40, " /NMMMy: :sMMMN. ")
- centerF(41, " dMMMMNdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddmMMMMd ")
- centerF(42, " :smMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmy: ")
- end
- --warning_tr
- local function warning_fr()
- gpu.setForeground(color)
- centerF(15, " /d ")
- centerF(16, " yMo ")
- centerF(17, " hMMy ")
- centerF(18, " y: dMMMm/ ")
- centerF(19, " NMo NMMMMMo h: ")
- centerF(20, " mMMmMMMMMMM/+MN: ")
- centerF(21, " MMMMMMMMMMMmmMMd ")
- centerF(22, " : +MMMMMMMMMMMMMMMMo ")
- centerF(23, " dh dMMMMMMMMMMMMMMMMN / ")
- centerF(24, " dMm+MMMMMMMMMMMMMMMMMMo yM/ ")
- centerF(25, " mMMMMMMMMMMMMhNMMMMMMMmhMMd ")
- centerF(26, " MMMMMMMMMMMMMo:NMMMMMMMMMMN ")
- centerF(27, " o +MMMMMMMMMMMMMs /MMMMMMMMMMN ")
- centerF(28, " NNmMMMMmMMMmMMMMo mMMmMMMMMMd ")
- centerF(29, " MMMMMMm NMd mMMM dMy:MMMMMM: ")
- centerF(30, ":MMMMMMy yMs :mMo s/ NMMMMm:h")
- centerF(31, ":MMMMyh+ Ns / :omMMMMMM")
- centerF(32, " MMMM+ :d NMMMMMm")
- centerF(33, " hMMMd : hMMMMMM/")
- centerF(34, " mMMMy :dMMMMMN/ ")
- centerF(35, " yMMMh: /yMMMMMms ")
- centerF(36, " :ymMMh+ +ymMMNmhs/ ")
- centerF(37, " :++osssso+++++oooo+++++ ")
- centerF(38, " ////////////////////// ")
- centerF(44, "Reactor Overheated")
- centerF(45, "Explosion risk")
- centerF(46, "Turning off reactor...")
- computer.beep(500)
- os.sleep(1)
- color = color==red and yellow or red
- end
- --warning_fr
- --warning_fr
- --functions
- hazard()
- while true do
- if getHeat() <= 50 then
- rs.setOutput(sides.top, 15)
- main_text()
- measurements()
- elseif getHeat() >= 50 then
- rs.setOutput(sides.top, 0)
- warning_tr()
- while getHeat() >= 50 do
- warning_fr()
- end
- end
- gpu.setForeground(white)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement