From ffeff86507b33617b64cdc7990cce05793ab0c06 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 11 Nov 2022 16:32:14 -0500 Subject: [PATCH] adjusted containment integrity to just be damage percent, moved up radiation indicator --- coordinator/startup.lua | 2 +- coordinator/ui/components/unit_detail.lua | 20 ++++++++++++-------- graphics/elements/indicators/data.lua | 3 ++- graphics/elements/indicators/power.lua | 1 + 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 847ee2d..84d1f4b 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -16,7 +16,7 @@ local config = require("coordinator.config") local coordinator = require("coordinator.coordinator") local renderer = require("coordinator.renderer") -local COORDINATOR_VERSION = "alpha-v0.6.7" +local COORDINATOR_VERSION = "alpha-v0.6.8" local print = util.print local println = util.println diff --git a/coordinator/ui/components/unit_detail.lua b/coordinator/ui/components/unit_detail.lua index b484578..9f91932 100644 --- a/coordinator/ui/components/unit_detail.lua +++ b/coordinator/ui/components/unit_detail.lua @@ -55,28 +55,33 @@ local function init(parent, id) local stat_fg_bg = cpair(colors.black,colors.white) TextBox{parent=main,x=21,y=3,text="Core Temp",height=1,fg_bg=style.label} - local core_temp = DataIndicator{parent=main,x=21,label="",format="%9.2f",value=0,unit="K",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} + local core_temp = DataIndicator{parent=main,x=21,label="",format="%10.2f",value=0,unit="K",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} r_ps.subscribe("temp", core_temp.update) main.line_break() TextBox{parent=main,x=21,text="Burn Rate",height=1,width=12,fg_bg=style.label} - local act_burn_r = DataIndicator{parent=main,x=21,label="",format="%6.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} + local act_burn_r = DataIndicator{parent=main,x=21,label="",format="%7.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} r_ps.subscribe("act_burn_rate", act_burn_r.update) main.line_break() TextBox{parent=main,x=21,text="Commanded Burn Rate",height=2,width=12,fg_bg=style.label} - local burn_r = DataIndicator{parent=main,x=21,label="",format="%6.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} + local burn_r = DataIndicator{parent=main,x=21,label="",format="%7.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} r_ps.subscribe("burn_rate", burn_r.update) main.line_break() TextBox{parent=main,x=21,text="Heating Rate",height=1,width=12,fg_bg=style.label} - local heating_r = DataIndicator{parent=main,x=21,label="",format="%11.0f",value=0,unit="",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} + local heating_r = DataIndicator{parent=main,x=21,label="",format="%12.0f",value=0,unit="",commas=true,lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} r_ps.subscribe("heating_rate", heating_r.update) main.line_break() - TextBox{parent=main,x=21,text="Containment Integrity",height=2,width=12,fg_bg=style.label} - local integ = DataIndicator{parent=main,x=21,label="",format="%9.0f",value=100,unit="%",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} - r_ps.subscribe("damage", function (x) integ.update(100.0 - x) end) + TextBox{parent=main,x=21,text="Damage",height=1,width=12,fg_bg=style.label} + local damage_p = DataIndicator{parent=main,x=21,label="",format="%10.0f",value=100,unit="%",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} + r_ps.subscribe("damage", damage_p.update) + main.line_break() + + ---@todo radiation monitor + TextBox{parent=main,x=21,text="Radiation",height=1,width=12,fg_bg=style.label} + DataIndicator{parent=main,x=21,label="",format="%6.2f",value=0,unit="mSv/h",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg} main.line_break() -- TextBox{parent=main,text="FL",x=21,y=19,height=1,width=2,fg_bg=style.label} @@ -241,7 +246,6 @@ local function init(parent, id) ---@todo radiation monitor IndicatorLight{parent=annunciator,label="Radiation Monitor",colors=cpair(colors.green,colors.gray)} IndicatorLight{parent=annunciator,label="Radiation Alarm",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS} - DataIndicator{parent=main,x=22,y=22,label="",format="%3.2f",value=0,unit="mSv/h",lu_colors=lu_cpair,width=11,fg_bg=stat_fg_bg} -- reactor controls -- diff --git a/graphics/elements/indicators/data.lua b/graphics/elements/indicators/data.lua index 5b5a35b..5ebc9cb 100644 --- a/graphics/elements/indicators/data.lua +++ b/graphics/elements/indicators/data.lua @@ -8,7 +8,7 @@ local element = require("graphics.element") ---@field label string indicator label ---@field unit? string indicator unit ---@field format string data format (lua string format) ----@field commas boolean whether to use commas if a number is given (default to false) +---@field commas? boolean whether to use commas if a number is given (default to false) ---@field lu_colors? cpair label foreground color (a), unit foreground color (b) ---@field value any default value ---@field parent graphics_element @@ -43,6 +43,7 @@ local function data(args) e.window.write(args.label) local data_start = string.len(args.label) + 2 + if string.len(args.label) == 0 then data_start = 1 end -- on state change ---@param value any new value diff --git a/graphics/elements/indicators/power.lua b/graphics/elements/indicators/power.lua index 70d6479..6c7282b 100644 --- a/graphics/elements/indicators/power.lua +++ b/graphics/elements/indicators/power.lua @@ -39,6 +39,7 @@ local function power(args) e.window.write(args.label) local data_start = string.len(args.label) + 2 + if string.len(args.label) == 0 then data_start = 1 end -- on state change ---@param value any new value