From 2a3ff8e185855a11e3777e92af6e4d7a3a8bbb71 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 11 May 2024 03:39:41 +0200 Subject: [PATCH] Medical Treatment - Fix low SpO2 making units go into cardiac arrest again (#10003) * Set SpO2 after successful CPR * Update fnc_cprLocal.sqf * Add API * Update fnc_cprLocal.sqf --- addons/medical_treatment/functions/fnc_cprLocal.sqf | 7 ++++++- docs/wiki/framework/medical-treatment-framework.md | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_cprLocal.sqf b/addons/medical_treatment/functions/fnc_cprLocal.sqf index 228774b2f6..e6b1299027 100644 --- a/addons/medical_treatment/functions/fnc_cprLocal.sqf +++ b/addons/medical_treatment/functions/fnc_cprLocal.sqf @@ -24,9 +24,14 @@ TRACE_2("cprLocal",_medic,_patient); private _bloodVolume = GET_BLOOD_VOLUME(_patient); private _successChance = linearConversion [BLOOD_VOLUME_CLASS_4_HEMORRHAGE, BLOOD_VOLUME_CLASS_2_HEMORRHAGE, _bloodVolume, GVAR(cprSuccessChanceMin), GVAR(cprSuccessChanceMax), true]; if ((random 1) < _successChance) then { + // If SpO2 is too low, it will make HR skyrocket to the point where patient goes back into CA + // Allow 3rd party mods to disable this mechanic + if (missionNamespace getVariable [QGVAR(setSpO2UponCPRSuccess), true] && {GET_SPO2(_patient) < DEFAULT_SPO2 / 2}) then { + _patient setVariable [VAR_SPO2, DEFAULT_SPO2 / 2, true]; + }; + TRACE_2("CPR random success",_bloodVolume,_successChance); [QEGVAR(medical,CPRSucceeded), _patient] call CBA_fnc_localEvent; } else { TRACE_2("CPR random fail",_bloodVolume,_successChance); }; - diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index 736295804a..52e661a516 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -128,3 +128,10 @@ If a mission maker wishes to disable Zeus access to the medical menu, they can s ```sqf ace_medical_gui_enableZeusModule = false; // default is true ``` + +### 3.3 SpO2 Configuration + +If 3rd party mods want to disable SpO2 being set to a minimum upon successful CPR, they can set the variable below: +```sqf +ace_medical_treatment_setSpO2UponCPRSuccess = false; // default is true +```