From ffd46722467f2e568adbdd6df7060c4de558ec68 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:53:40 +0300 Subject: [PATCH] [MIRROR] Health analyzer displays blood alcohol content (#1899) * Health analyzer displays blood alcohol content (#81306) --------- Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> Co-authored-by: san7890 --- code/game/machinery/medical_kiosk.dm | 2 ++ .../items/devices/scanners/health_analyzer.dm | 14 +++++++++++--- code/modules/mob/living/blood.dm | 11 +++++++++++ tgui/packages/tgui/interfaces/MedicalKiosk.jsx | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index 3b12e38a527..13fb79a480e 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -239,6 +239,7 @@ var/blood_percent = round((patient.blood_volume / BLOOD_VOLUME_NORMAL)*100) var/blood_type = patient.dna.blood_type var/blood_warning = " " + var/blood_alcohol = patient.get_blood_alcohol_content() for(var/thing in patient.diseases) //Disease Information var/datum/disease/D = thing @@ -358,6 +359,7 @@ data["bleed_status"] = bleed_status data["blood_levels"] = blood_percent - (chaos_modifier * (rand(1,35))) data["blood_status"] = blood_status + data["blood_alcohol"] = blood_alcohol data["chemical_list"] = chemical_list data["overdose_list"] = overdose_list data["addict_list"] = addict_list diff --git a/code/game/objects/items/devices/scanners/health_analyzer.dm b/code/game/objects/items/devices/scanners/health_analyzer.dm index 8ceb5bf9d89..7d9f93e7e4b 100644 --- a/code/game/objects/items/devices/scanners/health_analyzer.dm +++ b/code/game/objects/items/devices/scanners/health_analyzer.dm @@ -382,11 +382,19 @@ var/datum/reagent/R = GLOB.chemical_reagents_list[blood_id] blood_type = R ? R.name : blood_id if(carbontarget.blood_volume <= BLOOD_VOLUME_SAFE && carbontarget.blood_volume > BLOOD_VOLUME_OKAY) - render_list += "Blood level: LOW [blood_percent] %, [carbontarget.blood_volume] cl, [span_info("type: [blood_type]")]\n" + render_list += "Blood level: LOW [blood_percent]%, [carbontarget.blood_volume] cl, [span_info("type: [blood_type]")]\n" else if(carbontarget.blood_volume <= BLOOD_VOLUME_OKAY) - render_list += "Blood level: CRITICAL [blood_percent] %, [carbontarget.blood_volume] cl, [span_info("type: [blood_type]")]\n" + render_list += "Blood level: CRITICAL [blood_percent]%, [carbontarget.blood_volume] cl, [span_info("type: [blood_type]")]\n" else - render_list += "Blood level: [blood_percent] %, [carbontarget.blood_volume] cl, type: [blood_type]\n" + render_list += "Blood level: [blood_percent]%, [carbontarget.blood_volume] cl, type: [blood_type]\n" + + // Blood Alcohol Content + var/blood_alcohol_content = target.get_blood_alcohol_content() + if(blood_alcohol_content > 0) + if(blood_alcohol_content >= 0.24) + render_list += "Blood alcohol content: CRITICAL [blood_alcohol_content]%\n" + else + render_list += "Blood alcohol content: [blood_alcohol_content]%\n" // Cybernetics if(iscarbon(target)) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 0818532cc4d..4caa7dd1966 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -1,4 +1,6 @@ #define BLOOD_DRIP_RATE_MOD 90 //Greater number means creating blood drips more often while bleeding +// Conversion between internal drunk power and common blood alcohol content +#define DRUNK_POWER_TO_BLOOD_ALCOHOL 0.003 /**************************************************** BLOOD SYSTEM @@ -376,4 +378,13 @@ if(!B) B = new(T) +/mob/living/proc/get_blood_alcohol_content() + var/blood_alcohol_content = 0 + var/datum/status_effect/inebriated/inebriation = has_status_effect(/datum/status_effect/inebriated) + if(!isnull(inebriation)) + blood_alcohol_content = round(inebriation.drunk_value * DRUNK_POWER_TO_BLOOD_ALCOHOL, 0.01) + + return blood_alcohol_content + #undef BLOOD_DRIP_RATE_MOD +#undef DRUNK_POWER_TO_BLOOD_ALCOHOL diff --git a/tgui/packages/tgui/interfaces/MedicalKiosk.jsx b/tgui/packages/tgui/interfaces/MedicalKiosk.jsx index 5d8b081e0ef..98d71c04331 100644 --- a/tgui/packages/tgui/interfaces/MedicalKiosk.jsx +++ b/tgui/packages/tgui/interfaces/MedicalKiosk.jsx @@ -248,6 +248,7 @@ const MedicalKioskScanResults4 = (props) => { overdose_list = [], addict_list = [], hallucinating_status, + blood_alcohol, } = data; return (
@@ -281,6 +282,19 @@ const MedicalKioskScanResults4 = (props) => { {hallucinating_status} + + + + +
);