diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index cf2a35923d..9804520d9f 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -26,7 +26,7 @@ params ["_unit"]; if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith { 0 }; private _bloodVolume = ((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / DEFAULT_BLOOD_VOLUME) * 100; -private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; -private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / 80) - 1)) / 60; +private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; +private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / DEFAULT_HEART_RATE) - 1)) / 60; (0 max _cardiacOutput) diff --git a/addons/medical/functions/fnc_handleStateDefault.sqf b/addons/medical/functions/fnc_handleStateDefault.sqf index be4c4f9d79..c117b88c40 100644 --- a/addons/medical/functions/fnc_handleStateDefault.sqf +++ b/addons/medical/functions/fnc_handleStateDefault.sqf @@ -8,7 +8,7 @@ if (!alive _unit) exitWith {}; // If locality changed, broadcast the last medical state and finish the local loop if (!local _unit) exitWith { - _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true]; + _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; }; diff --git a/addons/medical/functions/fnc_handleStateInjured.sqf b/addons/medical/functions/fnc_handleStateInjured.sqf index be4c4f9d79..c117b88c40 100644 --- a/addons/medical/functions/fnc_handleStateInjured.sqf +++ b/addons/medical/functions/fnc_handleStateInjured.sqf @@ -8,7 +8,7 @@ if (!alive _unit) exitWith {}; // If locality changed, broadcast the last medical state and finish the local loop if (!local _unit) exitWith { - _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true]; + _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; }; diff --git a/addons/medical/functions/fnc_handleStateUnconscious.sqf b/addons/medical/functions/fnc_handleStateUnconscious.sqf index be4c4f9d79..c117b88c40 100644 --- a/addons/medical/functions/fnc_handleStateUnconscious.sqf +++ b/addons/medical/functions/fnc_handleStateUnconscious.sqf @@ -8,7 +8,7 @@ if (!alive _unit) exitWith {}; // If locality changed, broadcast the last medical state and finish the local loop if (!local _unit) exitWith { - _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true]; + _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true]; _unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true]; _unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true]; }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 2068815624..629196a932 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -86,7 +86,7 @@ _pain = _pain + (count _oldTourniquets) * 0.001 * _deltaT; [_unit, _deltaT, _syncValues] call FUNC(updatePainSuppress); [_unit, _deltaT, _syncValues] call FUNC(updatePeripheralResistance); -private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; +private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; private _bloodPressure = [_unit] call FUNC(getBloodPressure); _unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; diff --git a/addons/medical/functions/fnc_hasStableVitals.sqf b/addons/medical/functions/fnc_hasStableVitals.sqf index 83ae9a5de2..c021cbccc9 100644 --- a/addons/medical/functions/fnc_hasStableVitals.sqf +++ b/addons/medical/functions/fnc_hasStableVitals.sqf @@ -26,7 +26,7 @@ private _bloodPressure = [_unit] call FUNC(getBloodPressure); _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false }; -private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; +private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; if (_heartRate < 40) exitWith { false }; true diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index a5ebd01d2c..c7067b0ad2 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -33,7 +33,7 @@ _unit setVariable [QGVAR(bandagedWounds), [], true]; _unit setVariable [QGVAR(stitchedWounds), [], true]; // vitals -_unit setVariable [QGVAR(heartRate), 80, true]; +_unit setVariable [QGVAR(heartRate), DEFAULT_HEART_RATE, true]; _unit setVariable [QGVAR(heartRateAdjustments), [], true]; _unit setVariable [QGVAR(bloodPressure), [80, 120], true]; _unit setVariable [QGVAR(peripheralResistance), 100, true]; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 0fae5a65aa..9354784662 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -31,7 +31,7 @@ private _timeInCardiacArrest = 120 + round(random(600)); params ["_args", "_idPFH"]; _args params ["_unit", "_startTime", "_timeInCardiacArrest"]; - private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; + private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; if (_heartRate > 20 || !alive _unit) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setVariable [QGVAR(inCardiacArrest), nil, true]; diff --git a/addons/medical/functions/fnc_updateHeartRate.sqf b/addons/medical/functions/fnc_updateHeartRate.sqf index 704cda41db..eb872d1300 100644 --- a/addons/medical/functions/fnc_updateHeartRate.sqf +++ b/addons/medical/functions/fnc_updateHeartRate.sqf @@ -41,7 +41,7 @@ if (!(_adjustment isEqualTo [])) then { _unit setVariable [QGVAR(heartRateAdjustments), _adjustment, _syncValue]; }; -private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; +private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]; if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then { private _hrChange = 0; diff --git a/addons/medical/script_macros_medical.hpp b/addons/medical/script_macros_medical.hpp index 87af11df85..0e8751737e 100644 --- a/addons/medical/script_macros_medical.hpp +++ b/addons/medical/script_macros_medical.hpp @@ -13,6 +13,8 @@ #define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default}) #define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default}) +#define DEFAULT_HEART_RATE 80 + // --- blood // 0.077 l/kg * 80kg = 6.16l #define DEFAULT_BLOOD_VOLUME 6.0 // in liters diff --git a/addons/medical_treatment/functions/fnc_treatmentPartialHealLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentPartialHealLocal.sqf index f094398ee3..8e5d878e22 100644 --- a/addons/medical_treatment/functions/fnc_treatmentPartialHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentPartialHealLocal.sqf @@ -34,6 +34,10 @@ if ((_bodyPartDamage select 4) < 0.3 && {(_bodyPartDamage select 5) < 0.3}) then [_unit, false] call EFUNC(medical_engine,setLimping); }; +private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]; +private _bloodlossRemainder = (DEFAULT_BLOOD_VOLUME - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) * (1 - _healingPower); +_target setVariable [QEGVAR(medical,bloodVolume), _bloodVolume max (DEFAULT_BLOOD_VOLUME - _bloodlossRemainder), true]; + // Resetting damage _target setDamage 0;