diff --git a/addons/medical_gui/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical_gui/functions/fnc_handleUI_DisplayOptions.sqf index a4f9071f10..71c8ed4d45 100644 --- a/addons/medical_gui/functions/fnc_handleUI_DisplayOptions.sqf +++ b/addons/medical_gui/functions/fnc_handleUI_DisplayOptions.sqf @@ -97,7 +97,7 @@ private _entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTr private _ctrl = (_display displayCtrl (START_IDC + _forEachIndex)); if (!(_forEachIndex > AMOUNT_OF_ENTRIES)) then { _ctrl ctrlSetText (_x select 0); - private _code = format ["ace_medical_menu_pendingReopen = true; call %1;", (_x select 3)]; + private _code = format ["ace_medical_gui_pendingReopen = true; call %1;", (_x select 3)]; _ctrl ctrlSetEventHandler ["ButtonClick", _code]; _ctrl ctrlSetTooltip (_x select 0); // TODO implement _ctrl ctrlShow true; diff --git a/addons/medical_statemachine/functions/fnc_conditionExecutionDeath.sqf b/addons/medical_statemachine/functions/fnc_conditionExecutionDeath.sqf index 48b3ebe7a1..d02e1bd7e2 100644 --- a/addons/medical_statemachine/functions/fnc_conditionExecutionDeath.sqf +++ b/addons/medical_statemachine/functions/fnc_conditionExecutionDeath.sqf @@ -14,4 +14,4 @@ params ["_unit"]; -(GVAR(fatalInjuryCondition) < 2) && {!(_unit getVariable [QGVAR(deathBlocked), false])} +(GVAR(fatalInjuryCondition) < 2) && {!(_unit getVariable [QEGVAR(medical,deathBlocked), false])} diff --git a/addons/medical_statemachine/functions/fnc_enteredStateDeath.sqf b/addons/medical_statemachine/functions/fnc_enteredStateDeath.sqf index bda158a08f..7ec96bd43a 100644 --- a/addons/medical_statemachine/functions/fnc_enteredStateDeath.sqf +++ b/addons/medical_statemachine/functions/fnc_enteredStateDeath.sqf @@ -19,4 +19,7 @@ params ["_unit"]; // Send a local event before death [QEGVAR(medical,death), [_unit]] call CBA_fnc_localEvent; +_unit setVariable [VAR_HEART_RATE, 0, true]; +_unit setVariable [VAR_BLOOD_PRESS, [0, 0], true]; + _unit setDamage 1; diff --git a/addons/medical_status/CfgEventHandlers.hpp b/addons/medical_status/CfgEventHandlers.hpp index 7363a518fc..93107ab7d3 100644 --- a/addons/medical_status/CfgEventHandlers.hpp +++ b/addons/medical_status/CfgEventHandlers.hpp @@ -19,6 +19,7 @@ class Extended_PostInit_EventHandlers { class Extended_Init_EventHandlers { class CAManBase { class ADDON { + onRespawn = 1; init = QUOTE(call FUNC(initUnit)); }; }; diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf index 9eb8b80e1a..b899ab00f0 100644 --- a/addons/medical_status/functions/fnc_initUnit.sqf +++ b/addons/medical_status/functions/fnc_initUnit.sqf @@ -17,6 +17,8 @@ params ["_unit"]; +if (!local _unit) exitWith {}; + if (damage _unit > 0) then { _unit setDamage 0; }; diff --git a/addons/medical_vitals/functions/fnc_updateHeartRate.sqf b/addons/medical_vitals/functions/fnc_updateHeartRate.sqf index c20cf6cc1d..0946a76202 100644 --- a/addons/medical_vitals/functions/fnc_updateHeartRate.sqf +++ b/addons/medical_vitals/functions/fnc_updateHeartRate.sqf @@ -46,6 +46,7 @@ private _heartRate = GET_HEART_RATE(_unit); if !IN_CRDC_ARRST(_unit) then { private _hrChange = 0; + private _targetHR = 0; private _bloodVolume = GET_BLOOD_VOLUME(_unit); if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then { GET_BLOOD_PRESSURE(_unit) params ["_bloodPressureL", "_bloodPressureH"]; @@ -57,23 +58,26 @@ if !IN_CRDC_ARRST(_unit) then { _targetBP = _targetBP * (_bloodVolume / DEFAULT_BLOOD_VOLUME); }; - private _targetHR = DEFAULT_HEART_RATE; + _targetHR = DEFAULT_HEART_RATE; if (_bloodVolume < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) then { _targetHR = _heartRate * (_targetBP / (45 max _meanBP)); }; if (_painLevel > 0.2) then { _targetHR = _targetHR max (80 + 50 * _painLevel); }; - _targetHR = _targetHR + _hrTargetAdjustment; + _targetHR = (_targetHR + _hrTargetAdjustment) max 0; _hrChange = round(_targetHR - _heartRate) / 2; } else { _hrChange = -round(_heartRate / 10); }; - _heartRate = (_heartRate + _deltaT * _hrChange) max 0; + if (_hrChange < 0) then { + _heartRate = (_heartRate + _deltaT * _hrChange) max _targetHR; + } else { + _heartRate = (_heartRate + _deltaT * _hrChange) min _targetHR; + }; }; _unit setVariable [VAR_HEART_RATE, _heartRate, _syncValue]; _heartRate -