From 65ba8b8c071f0c74147b6ef69a1fe27452206d9f Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Tue, 12 Apr 2022 06:35:43 -0500 Subject: [PATCH] Fixes crewmonitor showing dead crew as green health ...When the cause of death is something not really shown by typical damage values, such as brain death :) EDIT: The TGUI linter hates that I write long comments --- tgui/packages/tgui/interfaces/CrewConsole.js | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CrewConsole.js b/tgui/packages/tgui/interfaces/CrewConsole.js index 97f4c118cfd2..2047541dc532 100644 --- a/tgui/packages/tgui/interfaces/CrewConsole.js +++ b/tgui/packages/tgui/interfaces/CrewConsole.js @@ -45,10 +45,19 @@ export const jobToColor = jobId => { return COLORS.department.other; }; -export const healthToColor = (oxy, tox, burn, brute) => { - const healthSum = oxy + tox + burn + brute; - const level = Math.min(Math.max(Math.ceil(healthSum / 25), 0), 5); - return HEALTH_COLOR_BY_LEVEL[level]; +export const healthToColor = (oxy, tox, burn, brute, is_alive) => { // Yogs -- show deadness + if (is_alive === null || is_alive) + { + if (oxy === null) // No damage data -- just show that they're alive + { + return HEALTH_COLOR_BY_LEVEL[0]; + } + const healthSum = oxy + tox + burn + brute; + const level = Math.min(Math.max(Math.ceil(healthSum / 25), 0), 5); + return HEALTH_COLOR_BY_LEVEL[level]; + } + return HEALTH_COLOR_BY_LEVEL[5]; // Dead is dead, son + // Yogs end }; export const HealthStat = props => { @@ -132,15 +141,12 @@ export const CrewConsoleContent = (props, context) => { + color={healthToColor( // yogs -- show death when dead + sensor.oxydam, + sensor.toxdam, + sensor.burndam, + sensor.brutedam, + sensor.life_status)} /> {sensor.oxydam !== null ? (