alignment and fixed has_build bugs

This commit is contained in:
Mikayla Fischler 2022-06-04 15:00:50 -04:00
parent dcb517d1cb
commit 07574aa116
4 changed files with 29 additions and 26 deletions

View File

@ -122,6 +122,7 @@ function boiler.new(session_id, unit_id, advert, out_queue)
self.db.build.ccoolant_cap = m_pkt.data[5]
self.db.build.superheaters = m_pkt.data[6]
self.db.build.max_boil_rate = m_pkt.data[7]
self.has_build = true
else
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
end
@ -163,7 +164,7 @@ function boiler.new(session_id, unit_id, advert, out_queue)
-- update this runner
---@param time_now integer milliseconds
function public.update(time_now)
if not self.periodics.has_build and self.periodics.next_build_req <= time_now then
if not self.has_build and self.periodics.next_build_req <= time_now then
_request_build()
self.periodics.next_build_req = time_now + PERIODICS.BUILD
end

View File

@ -86,6 +86,7 @@ function emachine.new(session_id, unit_id, advert, out_queue)
-- build response
if m_pkt.length == 1 then
self.db.build.max_energy = m_pkt.data[1]
self.has_build = true
else
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
end

View File

@ -83,7 +83,7 @@ function envd.new(session_id, unit_id, advert, out_queue)
-- update this runner
---@param time_now integer milliseconds
function public.update(time_now)
if not self.has_build and self.periodics.next_rad_req <= time_now then
if self.periodics.next_rad_req <= time_now then
_request_radiation()
self.periodics.next_rad_req = time_now + PERIODICS.RAD
end

View File

@ -119,6 +119,7 @@ function turbine.new(session_id, unit_id, advert, out_queue)
self.db.build.max_flow_rate = m_pkt.data[7]
self.db.build.max_production = m_pkt.data[8]
self.db.build.max_water_output = m_pkt.data[9]
self.has_build = true
else
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
end