From 6e077de829d2a7c95a1f443553e40289f939a278 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 17 Apr 2015 12:13:23 -0500 Subject: [PATCH] Medical - Use default value instead of 0 for getVar #683 - should prevent people getting knocked out from any damage source if the variables are undefined --- addons/medical/XEH_postInit.sqf | 2 +- addons/medical/functions/fnc_addToInjuredCollection.sqf | 6 +++--- addons/medical/functions/fnc_handleUnitVitals.sqf | 4 ++-- addons/medical/functions/fnc_setCardiacArrest.sqf | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 309bb2a888..ae6c87c1c6 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -248,7 +248,7 @@ if (USE_WOUND_EVENT_SYNC) then { }; [ - {(((_this select 0) getvariable [QGVAR(bloodVolume), 0]) < 65)}, + {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, {(((_this select 0) getvariable [QGVAR(pain), 0]) > 0.9)}, {(((_this select 0) call FUNC(getBloodLoss)) > 0.25)}, {((_this select 0) getvariable [QGVAR(inReviveState), false])}, diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index 82c385f0e1..cbe146d701 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -33,10 +33,10 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { [_this select 1] call CBA_fnc_removePerFrameHandler; if (!local _unit) then { if (GVAR(level) >= 2) then { - _unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 0], true]; - _unit setvariable [QGVAR(bloodPressure), _unit getvariable [QGVAR(bloodPressure), [0, 0]], true]; + _unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 80], true]; + _unit setvariable [QGVAR(bloodPressure), _unit getvariable [QGVAR(bloodPressure), [80, 120]], true]; }; - _unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 0], true]; + _unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 100], true]; }; } else { [_unit] call FUNC(handleUnitVitals); diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 81c9ffea40..2b175d7ca2 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -27,7 +27,7 @@ if (_syncValues) then { _unit setvariable [QGVAR(lastMomentValuesSynced), time]; }; -_bloodVolume = (_unit getvariable [QGVAR(bloodVolume), 0]) + ([_unit] call FUNC(getBloodVolumeChange)); +_bloodVolume = (_unit getvariable [QGVAR(bloodVolume), 100]) + ([_unit] call FUNC(getBloodVolumeChange)); _bloodVolume = _bloodVolume max 0; _unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; @@ -100,7 +100,7 @@ if (GVAR(level) >= 2) then { }; // Set the vitals - _heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); + _heartRate = (_unit getvariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); _unit setvariable [QGVAR(heartRate), _heartRate, _syncValues]; _bloodPressure = [_unit] call FUNC(getBloodPressure); diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index cebf968898..b4483defc2 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -33,7 +33,7 @@ _timeInCardiacArrest = 120 + round(random(600)); _startTime = _args select 1; _timeInCardiacArrest = _args select 2; - _heartRate = _unit getvariable [QGVAR(heartRate), 0]; + _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (_heartRate > 0 || !alive _unit) exitwith { [(_this select 1)] call cba_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true];