Skip to content

Commit

Permalink
Fix cardiac state module
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueTheKing committed Jan 30, 2024
1 parent 56fef50 commit 2a31a0f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions addons/circulation/functions/fnc_AEDX_VitalsMonitor.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ if (_patient getVariable [QGVAR(DefibrillatorPads_Connected), false] && {((_pati
if (GVAR(AdvRhythm)) then {
private _cardiacState = _patient getVariable [QGVAR(cardiacArrestType), 0];

if (_patient getVariable [QGVAR(cardiacArrestType), 0] in [2,4]) then {
if (_cardiacState in [2,4]) then {
_hr = _patient call FUNC(getCardiacArrestHeartRate);
} else {
_hr = _patient getVariable [QACEGVAR(medical,heartRate), 80];
};

if (!(_patient getVariable [QGVAR(cardiacArrestType), 0] in [0,2]) && !(GVAR(analyzeDelay))) then {
if (!(_cardiacState in [0,2]) && !(GVAR(analyzeDelay))) then {
[{
params ["_patient"];

Expand Down
4 changes: 2 additions & 2 deletions addons/circulation/functions/fnc_AED_Shock.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _patient setVariable [QGVAR(RhythmAnalyzed), false, true];
params ["_patient"];

_patient setVariable [QGVAR(heartRestart), false, true];
}, [_patient], 2] call CBA_fnc_waitAndExecute;
}, [_patient], 4] call CBA_fnc_waitAndExecute;

[{
params ["_patient"];
Expand All @@ -48,7 +48,7 @@ _patient setVariable [QGVAR(RhythmAnalyzed), false, true];
_patient setVariable [QGVAR(Defibrillator_ShockAmount), (_patient getVariable [QGVAR(Defibrillator_ShockAmount), 0]) + 1, true];

if (alive _patient) then {
if (_patient getVariable [VAR_CRDC_ARRST, false]) then {
if (IN_CRDC_ARRST(_patient)) then {
[QACEGVAR(medical_treatment,cprLocal), [_medic, _patient, _defibType], _patient] call CBA_fnc_targetEvent;
} else {
if (GVAR(AdvRhythm) && GVAR(AdvRhythm_Hardcore_Enable)) then {
Expand Down
4 changes: 4 additions & 0 deletions addons/circulation/functions/fnc_handleCardiacArrest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ private _cardiacArrestType = 0;
if !(GVAR(AdvRhythm)) exitWith {};
if !(alive _unit) exitWith {_unit setVariable [QGVAR(cardiacArrestType), 1, true];};

if ((_unit getVariable [QGVAR(cardiacArrestType), 0] != 0) && _initial) then {
_initial = false;
};

if (_initial) then {
if !(_active) exitWith {};

Expand Down
8 changes: 5 additions & 3 deletions addons/zeus/functions/fnc_ui_changeCardiacState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ private _fnc_onConfirm = {
private _currentState = _unit getVariable [QEGVAR(circulation,cardiacArrestType), 0];

private _state = lbCurSel (_display displayCtrl 16112);

_unit setVariable [QEGVAR(circulation,cardiacArrestType), _state, true];

if (_state isEqualTo 0) then {
[QACEGVAR(medical,CPRSucceeded), _unit] call CBA_fnc_localEvent;
[QACEGVAR(medical,CPRSucceeded), [_unit], _unit] call CBA_fnc_targetEvent;
} else {
if (_state > 0 && _currentState isEqualTo 0) then {
[QACEGVAR(medical,FatalVitals), _unit] call CBA_fnc_localEvent;
[QACEGVAR(medical,FatalVitals), [_unit], _unit] call CBA_fnc_targetEvent;
};
};
_unit setVariable [QEGVAR(circulation,cardiacArrestType), _state, true];
};

_display displayAddEventHandler ["unload", _fnc_onUnload];
Expand Down

0 comments on commit 2a31a0f

Please sign in to comment.