From b28fa367cbc8dea957490393d7020d42d187deec Mon Sep 17 00:00:00 2001 From: Thomas Kooi Date: Sun, 25 Jan 2015 16:40:47 +0100 Subject: [PATCH] Fixed unconscious. Now functions properly again after move from common to medical. --- addons/common/functions/fnc_isAwake.sqf | 2 +- addons/medical/XEH_postInit.sqf | 2 +- addons/medical/functions/fnc_handleDamage.sqf | 2 +- addons/medical/functions/fnc_handleUnitVitals.sqf | 12 +++++------- addons/medical/functions/fnc_setCardiacArrest.sqf | 4 +++- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/common/functions/fnc_isAwake.sqf b/addons/common/functions/fnc_isAwake.sqf index 4a5ed86aa8..10136c0369 100644 --- a/addons/common/functions/fnc_isAwake.sqf +++ b/addons/common/functions/fnc_isAwake.sqf @@ -12,4 +12,4 @@ private ["_unit","_return"]; _unit = _this select 0; -(!([_unit] call FUNC(isUnconscious))) && alive _unit && !(_unit getvariable ["ACE_isDead",false]); +(!(_unit getvariable ["ACE_isUnconscious",false]) && alive _unit && !(_unit getvariable ["ACE_isDead",false])); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 4581be6e07..062df32ddf 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -26,7 +26,7 @@ GVAR(injuredUnitCollection) = []; }; if (_pain > 45) then { if (random(1) > 0.6) then { - [_X] call EFUNC(common,setUnconsciousState); + [_X] call FUNC(setUnconsciousState); }; //[_X] call FUNC(playInjuredSound); }; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 8bb99300c9..a157a0b2ae 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -69,7 +69,7 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then { } else { [_unit] call FUNC(addToInjuredCollection); if ([_unit, _bodyPartn] call FUNC(determineIfUnconscious)) then { - [_unit] call EFUNC(common,setUnconsciousState); + [_unit] call FUNC(setUnconsciousState); } else { [_unit,_newDamage] call FUNC(handleReactionHit); }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index e6e3be14fc..7ced1ec393 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -60,7 +60,7 @@ if (_bloodVolume < 30) exitwith { if ([_unit] call EFUNC(common,isAwake)) then { if (_bloodVolume < 60) then { if (random(1) > 0.9) then { - [_unit] call EFUNC(common,setUnconsciousState); + [_unit] call FUNC(setUnconsciousState); }; }; }; @@ -97,13 +97,11 @@ if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) exitwit _bloodPressureL = _bloodPressure select 0; _bloodPressureH = _bloodPressure select 1; - - if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { - [_unit] call EFUNC(common,setUnconsciousState); // safety check to ensure unconsciousness for units if they are not dead already. - }; - - if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { + if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { + [_unit] call FUNC(setUnconsciousState); // safety check to ensure unconsciousness for units if they are not dead already. + }; + if (_bloodPressureH > 260) then { if (random(1) > 0.7) then { [_unit] call FUNC(setCardiacArrest); diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 6cc7787c76..090af82b49 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -20,11 +20,12 @@ _unit setvariable [QGVAR(inCardiacArrest), true,true]; ["Medical_onEnteredCardiacArrest", [_unit]] call ace_common_fnc_localEvent; -[_unit] call EFUNC(common,setUnconsciousState); +[_unit] call FUNC(setUnconsciousState); _counter = 120 + round(random(600)); _timer = 0; [{ + private ["_args","_unit","_timer","_counter","_heartRate"]; _args = _this select 0; _unit = _args select 0; _timer = _args select 1; @@ -36,6 +37,7 @@ _timer = 0; [(_this select 1)] call cba_fnc_removePerFrameHandler; }; if (_counter - _timer < 1) exitwith { + [_unit] call FUNC(setDead); [(_this select 1)] call cba_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true];