#118 coordinator code cleanup
This commit is contained in:
@@ -13,6 +13,7 @@ local cpair = core.graphics.cpair
|
||||
local border = core.graphics.border
|
||||
|
||||
-- new boiler view
|
||||
---@nodiscard
|
||||
---@param root graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
|
||||
@@ -19,6 +19,7 @@ local border = core.graphics.border
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
-- new induction matrix view
|
||||
---@nodiscard
|
||||
---@param root graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
|
||||
@@ -16,11 +16,8 @@ local DataIndicator = require("graphics.elements.indicators.data")
|
||||
local IndicatorLight = require("graphics.elements.indicators.light")
|
||||
local RadIndicator = require("graphics.elements.indicators.rad")
|
||||
local TriIndicatorLight = require("graphics.elements.indicators.trilight")
|
||||
local VerticalBar = require("graphics.elements.indicators.vbar")
|
||||
|
||||
local HazardButton = require("graphics.elements.controls.hazard_button")
|
||||
local MultiButton = require("graphics.elements.controls.multi_button")
|
||||
local PushButton = require("graphics.elements.controls.push_button")
|
||||
local RadioButton = require("graphics.elements.controls.radio_button")
|
||||
local SpinboxNumeric = require("graphics.elements.controls.spinbox_numeric")
|
||||
|
||||
@@ -32,6 +29,7 @@ local border = core.graphics.border
|
||||
local period = core.flasher.PERIOD
|
||||
|
||||
-- new process control view
|
||||
---@nodiscard
|
||||
---@param root graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local types = require("scada-common.types")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
@@ -13,6 +15,7 @@ local cpair = core.graphics.cpair
|
||||
local border = core.graphics.border
|
||||
|
||||
-- create new reactor view
|
||||
---@nodiscard
|
||||
---@param root graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
@@ -47,7 +50,7 @@ local function new_view(root, x, y, data, ps)
|
||||
local waste = HorizontalBar{parent=reactor_fills,x=8,y=5,show_percent=true,bar_fg_bg=cpair(colors.brown,colors.gray),height=1,width=14}
|
||||
|
||||
ps.subscribe("ccool_type", function (type)
|
||||
if type == "mekanism:sodium" then
|
||||
if type == types.FLUID.SODIUM then
|
||||
ccool.recolor(cpair(colors.lightBlue, colors.gray))
|
||||
else
|
||||
ccool.recolor(cpair(colors.blue, colors.gray))
|
||||
@@ -55,7 +58,7 @@ local function new_view(root, x, y, data, ps)
|
||||
end)
|
||||
|
||||
ps.subscribe("hcool_type", function (type)
|
||||
if type == "mekanism:superheated_sodium" then
|
||||
if type == types.FLUID.SUPERHEATED_SODIUM then
|
||||
hcool.recolor(cpair(colors.orange, colors.gray))
|
||||
else
|
||||
hcool.recolor(cpair(colors.white, colors.gray))
|
||||
|
||||
@@ -15,6 +15,7 @@ local cpair = core.graphics.cpair
|
||||
local border = core.graphics.border
|
||||
|
||||
-- new turbine view
|
||||
---@nodiscard
|
||||
---@param root graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
|
||||
@@ -57,6 +57,7 @@ local waste_opts = {
|
||||
}
|
||||
|
||||
-- create a unit view
|
||||
---@nodiscard
|
||||
---@param parent graphics_element parent
|
||||
---@param id integer
|
||||
local function init(parent, id)
|
||||
@@ -237,13 +238,13 @@ local function init(parent, id)
|
||||
local rcs_annunc = Div{parent=rcs,width=27,height=22,x=2,y=1}
|
||||
local rcs_tags = Div{parent=rcs,width=2,height=13,x=29,y=9}
|
||||
|
||||
local c_flt = IndicatorLight{parent=rcs_annunc,label="RCS Hardware Fault",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_emg = TriIndicatorLight{parent=rcs_annunc,label="Emergency Coolant",c1=colors.gray,c2=colors.white,c3=colors.yellow}
|
||||
local c_cfm = IndicatorLight{parent=rcs_annunc,label="Coolant Feed Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_brm = IndicatorLight{parent=rcs_annunc,label="Boil Rate Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_sfm = IndicatorLight{parent=rcs_annunc,label="Steam Feed Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_mwrf = IndicatorLight{parent=rcs_annunc,label="Max Water Return Feed",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_tbnt = IndicatorLight{parent=rcs_annunc,label="Turbine Trip",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
|
||||
local c_flt = IndicatorLight{parent=rcs_annunc,label="RCS Hardware Fault",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_emg = TriIndicatorLight{parent=rcs_annunc,label="Emergency Coolant",c1=colors.gray,c2=colors.white,c3=colors.yellow}
|
||||
local c_cfm = IndicatorLight{parent=rcs_annunc,label="Coolant Feed Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_brm = IndicatorLight{parent=rcs_annunc,label="Boil Rate Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_sfm = IndicatorLight{parent=rcs_annunc,label="Steam Feed Mismatch",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_mwrf = IndicatorLight{parent=rcs_annunc,label="Max Water Return Feed",colors=cpair(colors.yellow,colors.gray)}
|
||||
local c_tbnt = IndicatorLight{parent=rcs_annunc,label="Turbine Trip",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
|
||||
|
||||
u_ps.subscribe("RCSFault", c_flt.update)
|
||||
u_ps.subscribe("EmergencyCoolant", c_emg.update)
|
||||
|
||||
@@ -19,6 +19,7 @@ local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
local pipe = core.graphics.pipe
|
||||
|
||||
-- make a new unit overview window
|
||||
---@nodiscard
|
||||
---@param parent graphics_element parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
@@ -51,7 +52,7 @@ local function make(parent, x, y, unit)
|
||||
-- REACTOR --
|
||||
-------------
|
||||
|
||||
reactor_view(root, 1, 3, unit.reactor_data, unit.unit_ps)
|
||||
local _ = reactor_view(root, 1, 3, unit.reactor_data, unit.unit_ps)
|
||||
|
||||
if num_boilers > 0 then
|
||||
local coolant_pipes = {}
|
||||
@@ -101,16 +102,16 @@ local function make(parent, x, y, unit)
|
||||
local steam_pipes_b = {}
|
||||
|
||||
if no_boilers then
|
||||
table.insert(steam_pipes_b, pipe(0, 1, 3, 1, colors.white)) -- steam to turbine 1
|
||||
table.insert(steam_pipes_b, pipe(0, 2, 3, 2, colors.blue)) -- water to turbine 1
|
||||
table.insert(steam_pipes_b, pipe(0, 1, 3, 1, colors.white)) -- steam to turbine 1
|
||||
table.insert(steam_pipes_b, pipe(0, 2, 3, 2, colors.blue)) -- water to turbine 1
|
||||
|
||||
if num_turbines >= 2 then
|
||||
table.insert(steam_pipes_b, pipe(1, 2, 3, 9, colors.white)) -- steam to turbine 2
|
||||
table.insert(steam_pipes_b, pipe(2, 3, 3, 10, colors.blue)) -- water to turbine 2
|
||||
table.insert(steam_pipes_b, pipe(1, 2, 3, 9, colors.white)) -- steam to turbine 2
|
||||
table.insert(steam_pipes_b, pipe(2, 3, 3, 10, colors.blue)) -- water to turbine 2
|
||||
end
|
||||
|
||||
if num_turbines >= 3 then
|
||||
table.insert(steam_pipes_b, pipe(1, 9, 3, 17, colors.white)) -- steam boiler 1 to turbine 1 junction end
|
||||
table.insert(steam_pipes_b, pipe(1, 9, 3, 17, colors.white)) -- steam boiler 1 to turbine 1 junction end
|
||||
table.insert(steam_pipes_b, pipe(2, 10, 3, 18, colors.blue)) -- water boiler 1 to turbine 1 junction start
|
||||
end
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--
|
||||
-- Reactor Unit SCADA Coordinator GUI
|
||||
-- Reactor Unit Waiting Spinner
|
||||
--
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
@@ -16,6 +16,7 @@ local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
-- create a unit waiting view
|
||||
---@nodiscard
|
||||
---@param parent graphics_element parent
|
||||
---@param y integer y offset
|
||||
local function init(parent, y)
|
||||
|
||||
Reference in New Issue
Block a user