SHARE
TWEET

Nuclear Craft

JoeZwet Jan 25th, 2020 (edited) 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local gpu = component.gpu
  3. gpu.setResolution(80,25)
  4. local gui = require("gui")
  5. local event = require("event")
  6.  
  7. gui.checkVersion(2,5)
  8.  
  9. local prgName = "spegit"
  10. local version = "v1.0"
  11.  
  12.  
  13. local b_msr = false
  14. local b_he1 = false
  15. local b_he2 = false
  16. local b_he3 = false
  17. local b_he4 = false
  18. local b_t1  = false
  19. local b_t2  = false
  20.  
  21. local msr = component.proxy(component.nc_salt_fission_reactor.address)
  22. local he1 = component.proxy(component.list("nc_heat_exchanger", true)[0])
  23. local he2 = component.proxy(component.list("nc_heat_exchanger", true)[1])
  24. local he3 = component.proxy(component.list("nc_heat_exchanger", true)[2])
  25. local he4 = component.proxy(component.list("nc_heat_exchanger", true)[3])
  26. local t1  = component.proxy(component.list("nc_turbine",        true)[0])
  27. local t2  = component.proxy(component.list("nc_turbine",        true)[1])
  28.  
  29. -- Begin: Callbacks
  30. local function btn_msr_cb(guiID, buttonID)
  31.    -- Your code here
  32. end
  33.  
  34. local function btn_he1_cb(guiID, buttonID)
  35.    -- Your code here
  36. end
  37.  
  38. local function button_3_callback(guiID, buttonID)
  39.    -- Your code here
  40. end
  41.  
  42. local function btn_he3_cb(guiID, buttonID)
  43.    -- Your code here
  44. end
  45.  
  46. local function btn_he4_cb(guiID, buttonID)
  47.    -- Your code here
  48. end
  49.  
  50. local function btn_t1_cb(guiID, buttonID)
  51.    -- Your code here
  52. end
  53.  
  54. local function btn_t2_cb(guiID, buttonID)
  55.    -- Your code here
  56. end
  57.  
  58. local function btn_all_cb(guiID, buttonID)
  59.    -- Your code here
  60. end
  61.  
  62. local function exitButtonCallback(guiID, id)
  63.    local result = gui.getYesNo("", "Do you really want to exit?", "")
  64.    if result == true then
  65.       gui.exit()
  66.    end
  67.    gui.displayGui(mainGui)
  68.    refresh()
  69. end
  70. -- End: Callbacks
  71.  
  72. -- Begin: Menu definitions
  73. mainGui = gui.newGui(1, 2, 79, 23, true)
  74. label_msr = gui.newLabel(mainGui, 1, 1, "Molten Salt Reactor", 0xc0c0c0, 0x0, 7)
  75. label_msr_status = gui.newLabel(mainGui, 23, 1, "Offline", 0xfc0303, 0xf, 7)
  76. btn_msr = gui.newButton(mainGui, 33, 1, "Toggle", btn_msr_cb)
  77. label_he1 = gui.newLabel(mainGui, 1, 3, "Heat Exchanger #1", 0xc0c0c0, 0x0, 7)
  78. label_he1_status = gui.newLabel(mainGui, 23, 3, "Offline", 0xc0c0c0, 0x0, 7)
  79. btn_he1 = gui.newButton(mainGui, 33, 3, "Toggle", btn_he1_cb)
  80. label_he2 = gui.newLabel(mainGui, 1, 5, "Heat Exchanger #2", 0xc0c0c0, 0x0, 7)
  81. label_he2_status = gui.newLabel(mainGui, 23, 5, "Offline", 0xc0c0c0, 0x0, 7)
  82. btn_he2 = gui.newButton(mainGui, 33, 5, "Toggle", button_3_callback)
  83. label_he3 = gui.newLabel(mainGui, 1, 7, "Heat Exchanger #3", 0xc0c0c0, 0x0, 7)
  84. label_he3_status = gui.newLabel(mainGui, 23, 7, "Offline", 0xc0c0c0, 0x0, 7)
  85. btn_he3 = gui.newButton(mainGui, 33, 7, "Toggle", btn_he3_cb)
  86. label_he4 = gui.newLabel(mainGui, 1, 9, "Heat Exchanger #4", 0xc0c0c0, 0x0, 7)
  87. label_he4_status = gui.newLabel(mainGui, 23, 9, "Offline", 0xc0c0c0, 0x0, 7)
  88. btn_he4 = gui.newButton(mainGui, 33, 9, "Toggle", btn_he4_cb)
  89. label_t1 = gui.newLabel(mainGui, 1, 11, "Turbine #1", 0xc0c0c0, 0x0, 8)
  90. label_t1_status = gui.newLabel(mainGui, 23, 11, "Offline", 0xc0c0c0, 0x0, 8)
  91. btn_t1 = gui.newButton(mainGui, 33, 11, "Toggle", btn_t1_cb)
  92. label_t2 = gui.newLabel(mainGui, 1, 13, "Turbine #2", 0xc0c0c0, 0x0, 8)
  93. label_t2_status = gui.newLabel(mainGui, 23, 13, "Offline", 0xc0c0c0, 0x0, 8)
  94. btn_t2 = gui.newButton(mainGui, 33, 13, "Toggle", btn_t2_cb)
  95. label_all = gui.newLabel(mainGui, 1, 15, "All", 0xc0c0c0, 0x0, 3)
  96. btn_all = gui.newButton(mainGui, 33, 15, "Toggle", btn_all_cb)
  97. exitButton = gui.newButton(mainGui, 73, 23, "exit", exitButtonCallback)
  98. -- End: Menu definitions
  99.  
  100. -- Begin: Status checks
  101.  
  102. local function update_label(label, machine)
  103.     if machine.isReactorOn() then
  104.         label.text = "Online"
  105.         label.backgroundColor = colors.lime
  106.         label.foregroundColor = colors.black
  107.     else
  108.         label.text = "Offline"
  109.         label.backgroundColor = colors.red
  110.         label.foregroundColor = colors.white
  111.     end
  112. end
  113.  
  114. local function check_status()
  115.     update_label(label_msr, msr)
  116.     update_label(label_he1, he1)
  117.     update_label(label_he2, he2)
  118.     update_label(label_he3, he3)
  119.     update_label(label_he4, he4)
  120.     update_label(label_t1,  t1)
  121.     update_label(label_t2,  t2)
  122. end
  123.  
  124.  
  125. -- End: Status checks
  126.  
  127. gui.clearScreen()
  128. gui.setTop("Chernobyler")
  129. gui.setBottom("tech1: whats that sound? tech2: oh no.")
  130.  
  131. -- Main loop
  132. while true do
  133.    gui.runGui(mainGui)
  134.     check_status()
  135. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top