#186 fixed bug with facility update returning, improved damage status message
This commit is contained in:
@@ -93,10 +93,12 @@ function logic.update_annunciator(self)
|
||||
-- track damage
|
||||
if plc_db.mek_status.damage > 0 then
|
||||
if self.damage_start == 0 then
|
||||
self.damage_decreasing = false
|
||||
self.damage_start = util.time_s()
|
||||
self.damage_initial = plc_db.mek_status.damage
|
||||
end
|
||||
else
|
||||
self.damage_decreasing = false
|
||||
self.damage_start = 0
|
||||
self.damage_initial = 0
|
||||
self.damage_last = 0
|
||||
@@ -584,16 +586,25 @@ function logic.update_status_text(self)
|
||||
self.status_text[1] = "CONTAINMENT TAKING DAMAGE"
|
||||
if self.plc_cache.damage >= 100 then
|
||||
self.status_text[2] = "damage critical"
|
||||
elseif (self.plc_cache.damage - self.damage_initial) > 0 then
|
||||
if self.plc_cache.damage > self.damage_last then
|
||||
self.damage_last = self.plc_cache.damage
|
||||
local rate = (self.plc_cache.damage - self.damage_initial) / (util.time_s() - self.damage_start)
|
||||
self.damage_est_last = (100 - self.plc_cache.damage) / rate
|
||||
end
|
||||
elseif self.plc_cache.damage < self.damage_last then
|
||||
self.damage_decreasing = true
|
||||
self.status_text = { "CONTAINMENT TOOK DAMAGE", "damage level lowering..." }
|
||||
elseif (not self.damage_decreasing) or (self.plc_cache.damage > self.damage_last) then
|
||||
self.damage_decreasing = false
|
||||
|
||||
self.status_text[2] = util.c("damage critical in ", util.sprintf("%.1f", self.damage_est_last), "s")
|
||||
if (self.plc_cache.damage - self.damage_initial) > 0 then
|
||||
if self.plc_cache.damage > self.damage_last then
|
||||
self.damage_last = self.plc_cache.damage
|
||||
local rate = (self.plc_cache.damage - self.damage_initial) / (util.time_s() - self.damage_start)
|
||||
self.damage_est_last = (100 - self.plc_cache.damage) / rate
|
||||
end
|
||||
|
||||
self.status_text[2] = util.c("damage critical in ", util.sprintf("%.1f", self.damage_est_last), "s")
|
||||
else
|
||||
self.status_text[2] = "estimating time to critical..."
|
||||
end
|
||||
else
|
||||
self.status_text[2] = "estimating time to critical..."
|
||||
self.status_text = { "CONTAINMENT TOOK DAMAGE", "damage level lowering..." }
|
||||
end
|
||||
elseif is_active(self.alarms.ContainmentRadiation) then
|
||||
self.status_text[1] = "RADIATION DETECTED"
|
||||
|
||||
Reference in New Issue
Block a user