Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cmp = require("component")
- local gpu = cmp.gpu
- local term = require("term")
- local gui = require("zth_gui")
- local event = require("event")
- local isRunning = true
- local sides = require("sides")
- keyboard=require("keyboard")
- gpu.bind(cmp.get("160"))
- term.clear()
- TabReac1={Reactor=cmp.proxy(cmp.get("597")), RedBlock=cmp.proxy(cmp.get("b33"))}
- TabReac2={Reactor=cmp.proxy(cmp.get("0c6")), RedBlock=cmp.proxy(cmp.get("c6a"))}
- TabReac3={Reactor=cmp.proxy(cmp.get("1da")), RedBlock=cmp.proxy(cmp.get("ec8"))}
- TabReac4={Reactor=cmp.proxy(cmp.get("907")), RedBlock=cmp.proxy(cmp.get("d07"))}
- TabReac5={Reactor=cmp.proxy(cmp.get("b08")), RedBlock=cmp.proxy(cmp.get("d44"))}
- TabComponent={[1]=TabReac1, [2]=TabReac2, [3]=TabReac3, [4]=TabReac4, [5]=TabReac5}
- maxTemp=1000
- function sB1(newState1)
- local rs = TabComponent[1].RedBlock--cmp.proxy(cmp.get("b33"))
- if newState1 == "active" then
- rs.setOutput(sides.up, 15)
- else
- rs.setOutput(sides.up, 0)
- end
- end
- function sB2(newState2)
- local rs = TabComponent[2].RedBlock--cmp.proxy(cmp.get("c6a"))
- if newState2 == "active" then
- rs.setOutput(sides.up, 15)
- else
- rs.setOutput(sides.up, 0)
- end
- end
- function sB3(newState3)
- local rs = TabComponent[3].RedBlock--cmp.proxy(cmp.get("ec8"))
- if newState3 == "active" then
- rs.setOutput(sides.up, 15)
- else
- rs.setOutput(sides.up, 0)
- end
- end
- function sB4(newState4)
- local rs = TabComponent[4].RedBlock--cmp.proxy(cmp.get("d07"))
- if newState4 == "active" then
- rs.setOutput(sides.up, 15)
- else
- rs.setOutput(sides.up, 0)
- end
- end
- function sB5(newState5)
- local rs = TabComponent[5].RedBlock--cmp.proxy(cmp.get("d44"))
- if newState5 == "active" then
- rs.setOutput(sides.up, 15)
- else
- rs.setOutput(sides.up, 0)
- end
- end
- function exitProgram()
- term.clear()
- isRunning = false
- term.clear()
- end
- function callback(evID, ...)
- if evID then
- gui.callbackTouch(...)
- end
- end
- term.clear()
- gui.addButton(1, 20, "1", 0xFF0000, 0x00FF00, true, sB1)
- gui.addButton(10, 20, "2", 0xFF0000, 0x00FF00, true, sB2)
- gui.addButton(20, 20, "3", 0xFF0000, 0x00FF00, true, sB3)
- gui.addButton(30, 20, "4", 0xFF0000, 0x00FF00, true, sB4)
- gui.addButton(40, 20, "5", 0xFF0000, 0x00FF00, true, sB5)
- gui.addButton(71, 20, "Выход", 0xFF0000, 0xFF8888, false, exitProgram)
- event.listen("touch", callback)
- while isRunning do
- gui.drawUI()
- os.sleep(0.5)
- term.setCursor(1,1)
- gpu.setResolution(80,25)
- gpu.setBackground(0x0000CD)
- print("Реактор Температура eU/t Состояние")
- gpu.setBackground(0x0000FF)
- if keyboard.isKeyDown('r') then computer.shutdown(true) end
- for key=1,5 do
- str = "Включен " gpu.setBackground(0x00FF00)
- if TabComponent[key].RedBlock.getOutput(sides.up) == 0 then str = "Выключен" gpu.setBackground(0xFF0000) end
- -- print(' №'..key..,string.format( ' ',TabComponent[key].Reactor.getHeat(),' ',TabComponent[key].Reactor.getReactorEUOutput(), str)--,TestReac(key))
- local r = TabComponent[key].Reactor
- print(string.format("№%d %05.2f %05.3f %s", key, r.getHeat(), r.getReactorEUOutput(), str))
- end
- end
- term.clear()
- gpu.bind(cmp.get("e04"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement