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
This commit is contained in:
PabstMirror 2015-04-17 12:13:23 -05:00
parent bb2383cffd
commit 6e077de829
4 changed files with 7 additions and 7 deletions

View File

@ -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])},

View File

@ -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);

View File

@ -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);

View File

@ -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];