diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index 26d11ea..dced70a 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -1,15 +1,19 @@ -//params["_unit","_bodyPart","_amountOfDamage","_killer","_projectile","_context"]; params ["_unit", "_bodyPart", "_amountOfDamage", "_killer", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; - -if (alive _unit - && {_amountOfDamage >= 1} - && {!(_unit getVariable ["AT_Revive_isUnconscious",false])} - && {_bodyPart in ["","head","face_hub","head_hit","neck","spine1","spine2","spine3","pelvis","body"]} -) then { +if (_unit getVariable ["AT_Revive_isUnconscious", false]) then { _amountOfDamage = 0; - if(count (missionNamespace getVariable ["AT_Revive_setUnconscious", []]) == 0) then { - missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit, _killer,_projectile,0]]; +} else { + if (alive _unit + && {_amountOfDamage >= 1} + && {_bodyPart in ["","head","face_hub","head_hit","neck","spine1","spine2","spine3","pelvis","body"]} + ) then { + _unit setVariable ["AT_Revive_isUnconscious", true, true]; + _amountOfDamage = 0; + _unit setDamage 0; + _unit allowDamage false; + [_unit, _killer, _projectile] call ATR_FNC_BroadcastKill; + [_unit] call ATR_FNC_Unconscious; }; }; + _amountOfDamage; diff --git a/functions/Revive/fn_ReviveInit.sqf b/functions/Revive/fn_ReviveInit.sqf index 87ff0ac..cb9cedd 100644 --- a/functions/Revive/fn_ReviveInit.sqf +++ b/functions/Revive/fn_ReviveInit.sqf @@ -17,24 +17,6 @@ if(isNil("AT_Revive_MinRepawnTime")) then { AT_Revive_MinRepawnTime = getMissionConfigValue ["ATR_minRespawnTime", 10]; }; AT_Revive_Debug = false; -if(isNil("AT_Revive_FrameEH")) then { - AT_Revive_FrameEH = addMissionEventHandler ["EachFrame", { - if(count(missionNamespace getvariable ["AT_Revive_setUnconscious",[]])>0) then { - AT_Revive_setUnconscious params["_unit","_killer","_projectile","_frametimer"]; - if(_frametimer>=3) then { - missionNamespace setvariable ["AT_Revive_setUnconscious",[]]; - _unit setDamage 0; - _unit allowDamage false; - _unit setVariable ["AT_Revive_isUnconscious", true, true]; - [_unit] spawn ATR_FNC_Unconscious; - [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; - } else { - missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit,_killer,_projectile,_frametimer+1]]; - }; - }; - }]; -}; - [] spawn { waitUntil {!isNull player};