Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- gpu.setResolution(80,25)
- local gui = require("gui")
- local event = require("event")
- gui.checkVersion(2,5)
- local prgName = "spegit"
- local version = "v1.0"
- local b_msr = false
- local b_he1 = false
- local b_he2 = false
- local b_he3 = false
- local b_he4 = false
- local b_t1 = false
- local b_t2 = false
- local msr = component.proxy(component.nc_salt_fission_reactor.address)
- local he1 = component.proxy(component.list("nc_heat_exchanger", true)[0])
- local he2 = component.proxy(component.list("nc_heat_exchanger", true)[1])
- local he3 = component.proxy(component.list("nc_heat_exchanger", true)[2])
- local he4 = component.proxy(component.list("nc_heat_exchanger", true)[3])
- local t1 = component.proxy(component.list("nc_turbine", true)[0])
- local t2 = component.proxy(component.list("nc_turbine", true)[1])
- -- Begin: Callbacks
- local function btn_msr_cb(guiID, buttonID)
- -- Your code here
- end
- local function btn_he1_cb(guiID, buttonID)
- -- Your code here
- end
- local function button_3_callback(guiID, buttonID)
- -- Your code here
- end
- local function btn_he3_cb(guiID, buttonID)
- -- Your code here
- end
- local function btn_he4_cb(guiID, buttonID)
- -- Your code here
- end
- local function btn_t1_cb(guiID, buttonID)
- -- Your code here
- end
- local function btn_t2_cb(guiID, buttonID)
- -- Your code here
- end
- local function btn_all_cb(guiID, buttonID)
- -- Your code here
- end
- local function exitButtonCallback(guiID, id)
- local result = gui.getYesNo("", "Do you really want to exit?", "")
- if result == true then
- gui.exit()
- end
- gui.displayGui(mainGui)
- refresh()
- end
- -- End: Callbacks
- -- Begin: Menu definitions
- mainGui = gui.newGui(1, 2, 79, 23, true)
- label_msr = gui.newLabel(mainGui, 1, 1, "Molten Salt Reactor", 0xc0c0c0, 0x0, 7)
- label_msr_status = gui.newLabel(mainGui, 23, 1, "Offline", 0xfc0303, 0xf, 7)
- btn_msr = gui.newButton(mainGui, 33, 1, "Toggle", btn_msr_cb)
- label_he1 = gui.newLabel(mainGui, 1, 3, "Heat Exchanger #1", 0xc0c0c0, 0x0, 7)
- label_he1_status = gui.newLabel(mainGui, 23, 3, "Offline", 0xc0c0c0, 0x0, 7)
- btn_he1 = gui.newButton(mainGui, 33, 3, "Toggle", btn_he1_cb)
- label_he2 = gui.newLabel(mainGui, 1, 5, "Heat Exchanger #2", 0xc0c0c0, 0x0, 7)
- label_he2_status = gui.newLabel(mainGui, 23, 5, "Offline", 0xc0c0c0, 0x0, 7)
- btn_he2 = gui.newButton(mainGui, 33, 5, "Toggle", button_3_callback)
- label_he3 = gui.newLabel(mainGui, 1, 7, "Heat Exchanger #3", 0xc0c0c0, 0x0, 7)
- label_he3_status = gui.newLabel(mainGui, 23, 7, "Offline", 0xc0c0c0, 0x0, 7)
- btn_he3 = gui.newButton(mainGui, 33, 7, "Toggle", btn_he3_cb)
- label_he4 = gui.newLabel(mainGui, 1, 9, "Heat Exchanger #4", 0xc0c0c0, 0x0, 7)
- label_he4_status = gui.newLabel(mainGui, 23, 9, "Offline", 0xc0c0c0, 0x0, 7)
- btn_he4 = gui.newButton(mainGui, 33, 9, "Toggle", btn_he4_cb)
- label_t1 = gui.newLabel(mainGui, 1, 11, "Turbine #1", 0xc0c0c0, 0x0, 8)
- label_t1_status = gui.newLabel(mainGui, 23, 11, "Offline", 0xc0c0c0, 0x0, 8)
- btn_t1 = gui.newButton(mainGui, 33, 11, "Toggle", btn_t1_cb)
- label_t2 = gui.newLabel(mainGui, 1, 13, "Turbine #2", 0xc0c0c0, 0x0, 8)
- label_t2_status = gui.newLabel(mainGui, 23, 13, "Offline", 0xc0c0c0, 0x0, 8)
- btn_t2 = gui.newButton(mainGui, 33, 13, "Toggle", btn_t2_cb)
- label_all = gui.newLabel(mainGui, 1, 15, "All", 0xc0c0c0, 0x0, 3)
- btn_all = gui.newButton(mainGui, 33, 15, "Toggle", btn_all_cb)
- exitButton = gui.newButton(mainGui, 73, 23, "exit", exitButtonCallback)
- -- End: Menu definitions
- -- Begin: Status checks
- local function update_label(label, machine)
- if machine.isReactorOn() then
- label.text = "Online"
- label.backgroundColor = colors.lime
- label.foregroundColor = colors.black
- else
- label.text = "Offline"
- label.backgroundColor = colors.red
- label.foregroundColor = colors.white
- end
- end
- local function check_status()
- update_label(label_msr, msr)
- update_label(label_he1, he1)
- update_label(label_he2, he2)
- update_label(label_he3, he3)
- update_label(label_he4, he4)
- update_label(label_t1, t1)
- update_label(label_t2, t2)
- end
- -- End: Status checks
- gui.clearScreen()
- gui.setTop("Chernobyler")
- gui.setBottom("tech1: whats that sound? tech2: oh no.")
- -- Main loop
- while true do
- gui.runGui(mainGui)
- check_status()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement