#111 support unformed reactors

This commit is contained in:
Mikayla Fischler 2022-11-02 13:45:52 -04:00
parent d87dfb9ebd
commit 54264f5149
5 changed files with 10 additions and 7 deletions

View File

@ -112,7 +112,8 @@ function iocontrol.record_builds(builds)
unit.reactor_ps.publish(key, val)
end
if unit.reactor_data.mek_struct.length ~= 0 and unit.reactor_data.mek_struct.width ~= 0 then
if (type(unit.reactor_data.mek_struct.length) == "number") and (unit.reactor_data.mek_struct.length ~= 0) and
(type(unit.reactor_data.mek_struct.width) == "number") and (unit.reactor_data.mek_struct.width ~= 0) then
unit.reactor_ps.publish("size", { unit.reactor_data.mek_struct.length, unit.reactor_data.mek_struct.width })
end
end

View File

@ -16,7 +16,7 @@ local config = require("coordinator.config")
local coordinator = require("coordinator.coordinator")
local renderer = require("coordinator.renderer")
local COORDINATOR_VERSION = "alpha-v0.5.12"
local COORDINATOR_VERSION = "alpha-v0.6.0"
local print = util.print
local println = util.println

View File

@ -141,6 +141,7 @@ local function init(parent, id)
local rps_noc = IndicatorLight{parent=annunciator,label="No Coolant",colors=cpair(colors.yellow,colors.gray)}
local rps_flt = IndicatorLight{parent=annunciator,label="PPM Fault",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_500_MS}
local rps_tmo = IndicatorLight{parent=annunciator,label="Timeout",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_500_MS}
local rps_sfl = IndicatorLight{parent=annunciator,label="System Failure",colors=cpair(colors.orange,colors.gray),flash=true,period=period.BLINK_500_MS}
r_ps.subscribe("rps_tripped", rps_trp.update)
r_ps.subscribe("dmg_crit", rps_dmg.update)
@ -151,6 +152,7 @@ local function init(parent, id)
r_ps.subscribe("no_cool", rps_noc.update)
r_ps.subscribe("fault", rps_flt.update)
r_ps.subscribe("timeout", rps_tmo.update)
r_ps.subscribe("sys_fail", rps_sfl.update)
annunciator.line_break()
@ -171,7 +173,7 @@ local function init(parent, id)
-- machine-specific indicators
if unit.num_boilers > 0 then
TextBox{parent=main,x=32,y=34,text="B1",width=2,height=1,fg_bg=cpair(colors.black, colors.white)}
TextBox{parent=main,x=32,y=35,text="B1",width=2,height=1,fg_bg=cpair(colors.black, colors.white)}
local b1_hr = IndicatorLight{parent=annunciator,label="Heating Rate Low",colors=cpair(colors.yellow,colors.gray)}
b_ps[1].subscribe("HeatingRateLow", b1_hr.update)
end

View File

@ -304,7 +304,7 @@ function plc.new_session(id, for_reactor, in_queue, out_queue)
self.sDB.formed = pkt.data[5]
if not self.sDB.no_reactor and self.sDB.formed then
self.sDB.mek_status.heating_rate = pkt.data[6]
self.sDB.mek_status.heating_rate = pkt.data[6] or 0.0
-- attempt to read mek_data table
if pkt.data[7] ~= nil then
@ -471,7 +471,7 @@ function plc.new_session(id, for_reactor, in_queue, out_queue)
if self.received_struct then
return self.sDB.mek_struct
else
return nil
return {}
end
end
@ -480,7 +480,7 @@ function plc.new_session(id, for_reactor, in_queue, out_queue)
if self.received_status_cache then
return self.sDB.mek_status
else
return nil
return {}
end
end

View File

@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions")
local config = require("supervisor.config")
local supervisor = require("supervisor.supervisor")
local SUPERVISOR_VERSION = "beta-v0.6.6"
local SUPERVISOR_VERSION = "beta-v0.6.7"
local print = util.print
local println = util.println