From 311e66dc5362d282fef6d99f4f809178f58358a1 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 20 Apr 2024 02:18:04 +0300 Subject: [PATCH 1/6] Revert "Fixed wrong namespace" This reverts commit 794c98610e1963839147d15677d7c2129e2d9469. --- functions/Revive/fn_HandleDamage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index 26d11ea..e538556 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -8,7 +8,7 @@ if (alive _unit && {_bodyPart in ["","head","face_hub","head_hit","neck","spine1","spine2","spine3","pelvis","body"]} ) then { _amountOfDamage = 0; - if(count (missionNamespace getVariable ["AT_Revive_setUnconscious", []]) == 0) then { + if(count (_unit getVariable ["AT_Revive_setUnconscious", []]) == 0) then { missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit, _killer,_projectile,0]]; }; }; From 5a6809b0a355dc7b829db805d7c5f791999dbede Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 20 Apr 2024 02:18:48 +0300 Subject: [PATCH 2/6] Revert "Added Frametimer" This reverts commit 0b4b93870e283122b12a812b374578bc8f16b5a6. --- functions/Revive/fn_HandleDamage.sqf | 2 +- functions/Revive/fn_ReviveInit.sqf | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index e538556..0ee7c46 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -9,7 +9,7 @@ if (alive _unit ) then { _amountOfDamage = 0; if(count (_unit getVariable ["AT_Revive_setUnconscious", []]) == 0) then { - missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit, _killer,_projectile,0]]; + missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit, _killer,_projectile]]; }; }; _amountOfDamage; diff --git a/functions/Revive/fn_ReviveInit.sqf b/functions/Revive/fn_ReviveInit.sqf index 87ff0ac..861a80a 100644 --- a/functions/Revive/fn_ReviveInit.sqf +++ b/functions/Revive/fn_ReviveInit.sqf @@ -20,17 +20,13 @@ 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]]; - }; + AT_Revive_setUnconscious params["_unit","_killer","_projectile"]; + missionNamespace setvariable ["AT_Revive_setUnconscious",[]]; + _unit setDamage 0; + _unit allowDamage false; + _unit setVariable ["AT_Revive_isUnconscious", true, true]; + [_unit] call ATR_FNC_Unconscious; + [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; }; }]; }; From 9f7cdfdd6f7e8dec00151f7c91929e0eea101547 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 20 Apr 2024 02:21:51 +0300 Subject: [PATCH 3/6] Revert "Improved: All hit events triggering an inconscious state are now handled one frame delayed (prevents race condition between spawned scripts and eventhandlers)" This reverts commit bd963354e2bf252ff17ab8ef878cb03eebfc8c52. --- functions/Revive/fn_HandleDamage.sqf | 8 ++++++-- functions/Revive/fn_ReviveInit.sqf | 14 -------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index 0ee7c46..5e6b47a 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -8,8 +8,12 @@ if (alive _unit && {_bodyPart in ["","head","face_hub","head_hit","neck","spine1","spine2","spine3","pelvis","body"]} ) then { _amountOfDamage = 0; - if(count (_unit getVariable ["AT_Revive_setUnconscious", []]) == 0) then { - missionNamespace setvariable ["AT_Revive_setUnconscious",[_unit, _killer,_projectile]]; + if(!(_unit getVariable ["AT_Revive_isUnconscious", false])) then { + _unit setDamage 0; + _unit allowDamage false; + _unit setVariable ["AT_Revive_isUnconscious", true, true]; + [_unit] call ATR_FNC_Unconscious; + [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; }; }; _amountOfDamage; diff --git a/functions/Revive/fn_ReviveInit.sqf b/functions/Revive/fn_ReviveInit.sqf index 861a80a..cb9cedd 100644 --- a/functions/Revive/fn_ReviveInit.sqf +++ b/functions/Revive/fn_ReviveInit.sqf @@ -17,20 +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"]; - missionNamespace setvariable ["AT_Revive_setUnconscious",[]]; - _unit setDamage 0; - _unit allowDamage false; - _unit setVariable ["AT_Revive_isUnconscious", true, true]; - [_unit] call ATR_FNC_Unconscious; - [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; - }; - }]; -}; - [] spawn { waitUntil {!isNull player}; From 93d679abe10fee48dad96e9077c63ddba7c2b5a8 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 20 Apr 2024 02:34:47 +0300 Subject: [PATCH 4/6] Fix multiple deaths --- functions/Revive/fn_HandleDamage.sqf | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index 5e6b47a..9e080c3 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -1,19 +1,20 @@ //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(!(_unit getVariable ["AT_Revive_isUnconscious", false])) then { +} 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 setVariable ["AT_Revive_isUnconscious", true, true]; [_unit] call ATR_FNC_Unconscious; [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; }; }; + _amountOfDamage; From c5b4a8cee590d0cb67fa27ea7b61de97829856a8 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 21 Apr 2024 01:53:59 +0300 Subject: [PATCH 5/6] Fix Teamkill Report --- functions/Revive/fn_HandleDamage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index 9e080c3..f1f1327 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -12,8 +12,8 @@ if (_unit getVariable ["AT_Revive_isUnconscious", false]) then { _amountOfDamage = 0; _unit setDamage 0; _unit allowDamage false; + [_unit, _killer, _projectile] call ATR_FNC_BroadcastKill; [_unit] call ATR_FNC_Unconscious; - [_unit, _killer, _projectile] spawn ATR_FNC_BroadcastKill; }; }; From 4b4f5bc8c8a0d0793d16b3d2b62e68f8e8be3a16 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 21 Apr 2024 01:55:04 +0300 Subject: [PATCH 6/6] Cleanup params --- functions/Revive/fn_HandleDamage.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/Revive/fn_HandleDamage.sqf b/functions/Revive/fn_HandleDamage.sqf index f1f1327..dced70a 100644 --- a/functions/Revive/fn_HandleDamage.sqf +++ b/functions/Revive/fn_HandleDamage.sqf @@ -1,4 +1,3 @@ -//params["_unit","_bodyPart","_amountOfDamage","_killer","_projectile","_context"]; params ["_unit", "_bodyPart", "_amountOfDamage", "_killer", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; if (_unit getVariable ["AT_Revive_isUnconscious", false]) then {