Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- *****************************
- () Nuclear control ()
- *****************************
- Made by: HANDZ
- connect all wires through bundled cable, connected to the back of a computer !!
- overheat - yellow wire
- active - black wire
- full storage - pink wire
- user interaction - blue wire
- output to reactor - lime wire
- place alarm on top of a computer --> it will turn on if the reactor is overheating
- --]]
- --code dont touch :D
- x,y = term.getSize()
- overHeat = false
- active = false
- fullStorage = false
- userInteraction = false
- log = ""
- fl = true
- function reactor(st)
- setO = rs.setBundledOutput
- if st == "activate" then
- setO("back", 0)
- else
- setO("back", colors.lime)
- end
- end
- function alarm(st)
- sAO = rs.setOutput
- if st == "activate" then
- sAO("top", true)
- else
- sAO("top", false)
- end
- end
- function drawLogo()
- x,y = term.getSize()
- term.clear()
- term.setCursorPos(1,1)
- drawAcros(1,"*")
- drawCentred(2,"Nuclear control","()")
- drawAcros(3,"*")
- end
- function readInputs()
- rsTest = rs.testBundledInput
- overHeat = rsTest("back", colors.yellow)
- active = not(rsTest("back", colors.black))
- fullStorage = rsTest("back", colors.pink)
- userInteraction = rsTest("back", colors.blue)
- end
- function updateReactorStatus()
- if not(overHeat or userInteraction or fullStorage) then
- reactor("activate")
- else
- reactor("deactivate")
- end
- if overHeat then
- alarm("activate")
- else
- alarm("deactivate")
- end
- if overHeat and not(userInteraction) then
- if active then
- print("Reactor status: OVERHEATING")
- print()
- print("!!! Shutting Down !!!")
- print()
- else
- print("Reactor status: Cooling down")
- end
- elseif active then
- print("Reactor status: ONLINE")
- else
- print("Reactor status: OFFLINE")
- end
- if userInteraction then
- print("/-/ user interaction /-/")
- end
- if fullStorage then
- print("Storage status: FULL")
- if active and not(overHeat or userInteraction) then
- print()
- print("Shutting down")
- print()
- end
- else
- print("Storage status: OK")
- end
- log = "Shutted down because of"
- fl = true
- if overHeat then
- log = log.." overheating"
- fl = false
- end
- if userInteraction then
- if not(fl) then
- log = log.." and"
- end
- log = log.." user interaction"
- fl = false
- end
- if fullStorage then
- if not(fl) then
- log = log.." and"
- end
- log = log.." full storage"
- fl = false
- end
- if not(active) then
- print()
- print(log)
- end
- end
- function drawCentred(line,text,char)
- term.setCursorPos(1,line)
- term.write(char)
- local a = (x - string.len(text)) / 2
- term.setCursorPos(a+1, line)
- term.write(text)
- local b = x - string.len(char)
- term.setCursorPos(b+1,line)
- term.write(char)
- end
- function drawAcros(line, char)
- term.setCursorPos(1, line)
- for i=0,x do
- term.write(char)
- end
- end
- while true do
- drawLogo()
- readInputs()
- updateReactorStatus()
- drawCentred(y,"Made by: HANDZ","+++")
- sleep(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement