Skip to content

Commit

Permalink
Medical Treatment - Fix low SpO2 making units go into cardiac arrest …
Browse files Browse the repository at this point in the history
…again (#10003)

* Set SpO2 after successful CPR

* Update fnc_cprLocal.sqf

* Add API

* Update fnc_cprLocal.sqf
  • Loading branch information
johnb432 authored May 11, 2024
1 parent 62353a9 commit 2a3ff8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addons/medical_treatment/functions/fnc_cprLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

7 changes: 7 additions & 0 deletions docs/wiki/framework/medical-treatment-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 2a3ff8e

Please sign in to comment.