mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
color reactor coolant bars based on coolant type
This commit is contained in:
parent
a633f5b4c3
commit
a591cab338
@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol")
|
||||
local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
|
||||
local COORDINATOR_VERSION = "beta-v0.8.2"
|
||||
local COORDINATOR_VERSION = "beta-v0.8.3"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -45,16 +45,27 @@ local function new_view(root, x, y, data, ps)
|
||||
TextBox{parent=reactor_fills,text="HCOOL",x=2,y=4,height=1,fg_bg=text_fg_bg}
|
||||
TextBox{parent=reactor_fills,text="WASTE",x=2,y=5,height=1,fg_bg=text_fg_bg}
|
||||
|
||||
-- local ccool_color = util.trinary(data.mek_status.ccool_type == "sodium", cpair(colors.lightBlue,colors.gray), cpair(colors.blue,colors.gray))
|
||||
-- local hcool_color = util.trinary(data.mek_status.hcool_type == "superheated_sodium", cpair(colors.orange,colors.gray), cpair(colors.white,colors.gray))
|
||||
local ccool_color = util.trinary(true, cpair(colors.lightBlue,colors.gray), cpair(colors.blue,colors.gray))
|
||||
local hcool_color = util.trinary(true, cpair(colors.orange,colors.gray), cpair(colors.white,colors.gray))
|
||||
|
||||
local fuel = HorizontalBar{parent=reactor_fills,x=8,y=1,show_percent=true,bar_fg_bg=cpair(colors.black,colors.gray),height=1,width=14}
|
||||
local ccool = HorizontalBar{parent=reactor_fills,x=8,y=2,show_percent=true,bar_fg_bg=ccool_color,height=1,width=14}
|
||||
local hcool = HorizontalBar{parent=reactor_fills,x=8,y=4,show_percent=true,bar_fg_bg=hcool_color,height=1,width=14}
|
||||
local ccool = HorizontalBar{parent=reactor_fills,x=8,y=2,show_percent=true,bar_fg_bg=cpair(colors.blue,colors.gray),height=1,width=14}
|
||||
local hcool = HorizontalBar{parent=reactor_fills,x=8,y=4,show_percent=true,bar_fg_bg=cpair(colors.white,colors.gray),height=1,width=14}
|
||||
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
|
||||
ccool.recolor(cpair(colors.lightBlue, colors.gray))
|
||||
else
|
||||
ccool.recolor(cpair(colors.blue, colors.gray))
|
||||
end
|
||||
end)
|
||||
|
||||
ps.subscribe("hcool_type", function (type)
|
||||
if type == "mekanism:superheated_sodium" then
|
||||
hcool.recolor(cpair(colors.orange, colors.gray))
|
||||
else
|
||||
hcool.recolor(cpair(colors.white, colors.gray))
|
||||
end
|
||||
end)
|
||||
|
||||
ps.subscribe("fuel_fill", fuel.update)
|
||||
ps.subscribe("ccool_fill", ccool.update)
|
||||
ps.subscribe("hcool_fill", hcool.update)
|
||||
|
@ -94,8 +94,8 @@ local function init(parent, id)
|
||||
TextBox{parent=main,text="W",x=29,y=22,width=1,height=1,fg_bg=style.label}
|
||||
|
||||
local fuel = VerticalBar{parent=main,x=23,y=23,fg_bg=cpair(colors.black,colors.gray),height=4,width=1}
|
||||
local ccool = VerticalBar{parent=main,x=25,y=23,fg_bg=cpair(colors.lightBlue,colors.gray),height=4,width=1}
|
||||
local hcool = VerticalBar{parent=main,x=27,y=23,fg_bg=cpair(colors.orange,colors.gray),height=4,width=1}
|
||||
local ccool = VerticalBar{parent=main,x=25,y=23,fg_bg=cpair(colors.blue,colors.gray),height=4,width=1}
|
||||
local hcool = VerticalBar{parent=main,x=27,y=23,fg_bg=cpair(colors.white,colors.gray),height=4,width=1}
|
||||
local waste = VerticalBar{parent=main,x=29,y=23,fg_bg=cpair(colors.brown,colors.gray),height=4,width=1}
|
||||
|
||||
r_ps.subscribe("fuel_fill", fuel.update)
|
||||
@ -103,6 +103,22 @@ local function init(parent, id)
|
||||
r_ps.subscribe("hcool_fill", hcool.update)
|
||||
r_ps.subscribe("waste_fill", waste.update)
|
||||
|
||||
r_ps.subscribe("ccool_type", function (type)
|
||||
if type == "mekanism:sodium" then
|
||||
ccool.recolor(cpair(colors.lightBlue, colors.gray))
|
||||
else
|
||||
ccool.recolor(cpair(colors.blue, colors.gray))
|
||||
end
|
||||
end)
|
||||
|
||||
r_ps.subscribe("hcool_type", function (type)
|
||||
if type == "mekanism:superheated_sodium" then
|
||||
hcool.recolor(cpair(colors.orange, colors.gray))
|
||||
else
|
||||
hcool.recolor(cpair(colors.white, colors.gray))
|
||||
end
|
||||
end)
|
||||
|
||||
TextBox{parent=main,x=32,y=22,text="Core Temp",height=1,width=9,fg_bg=style.label}
|
||||
local core_temp = DataIndicator{parent=main,x=32,label="",format="%11.2f",value=0,unit="K",lu_colors=lu_cpair,width=13,fg_bg=stat_fg_bg}
|
||||
r_ps.subscribe("temp", core_temp.update)
|
||||
|
@ -363,6 +363,12 @@ function element.new(args)
|
||||
protected.disable()
|
||||
end
|
||||
|
||||
-- custom recolor command, varies by element if implemented
|
||||
---@vararg cpair|color color(s)
|
||||
function public.recolor(...)
|
||||
protected.recolor(...)
|
||||
end
|
||||
|
||||
-- resize attributes of the element value if supported
|
||||
---@vararg number dimensions (element specific)
|
||||
function public.resize(...)
|
||||
|
@ -106,7 +106,9 @@ local function hbar(args)
|
||||
|
||||
-- re-draw
|
||||
last_num_bars = 0
|
||||
e.on_update(e.value)
|
||||
if type(e.value) == "number" then
|
||||
e.on_update(e.value)
|
||||
end
|
||||
end
|
||||
|
||||
-- set the percentage value
|
||||
|
@ -89,7 +89,9 @@ local function vbar(args)
|
||||
|
||||
-- re-draw
|
||||
last_num_bars = 0
|
||||
e.on_update(e.value)
|
||||
if type(e.value) == "number" then
|
||||
e.on_update(e.value)
|
||||
end
|
||||
end
|
||||
|
||||
-- set the percentage value
|
||||
|
Loading…
Reference in New Issue
Block a user