From 4f0d222988394c7630892c3cd7850e3b20926116 Mon Sep 17 00:00:00 2001 From: dayrain Date: Fri, 12 Jul 2024 02:05:36 +0900 Subject: [PATCH 1/6] Display self-revive cooldown in unconscious state --- .../core/functions/Revive/fn_unconscious.sqf | 41 ++++++++++++++++++- A3A/addons/scrt/Stringtable.xml | 8 ++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index bf71dd9008..53755aac83 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -4,6 +4,7 @@ private _bleedOut = time + 450; private _isPlayer = false; private _playersX = false; private _inPlayerGroup = false; +private _handlerCountdown = 0; _unit setBleedingremaining 300; private _fnc_applyPostEffect = { @@ -16,6 +17,41 @@ private _fnc_applyPostEffect = { "filmGrain" ppEffectEnable true; }; +private _fnc_selfReviveCountdownStart = { + private _diff = (player getVariable ["A3A_selfReviveTimeout", -1]) - time; + private _initialCountDown = [_diff] call BIS_fnc_countDown; + + if (_diff > 0) then { + _handlerCountdown = addMissionEventHandler [ + "EachFrame", + { + hintSilent parseText format[ + "%1
%2", + localize "STR_antistasi_actions_unconscious_self_withstand_countdown", + [(([0] call BIS_fnc_countdown) / 60) + .01, "HH:MM"] call BIS_fnc_timetostring + ] + } + ]; + } + else { + _handlerCountdown = addMissionEventHandler [ + "EachFrame", + { + hintSilent parseText format[ + "%1
%2", + localize "STR_antistasi_actions_unconscious_self_withstand_countdown", + localize "STR_antistasi_actions_unconscious_self_withstand_ready" + ] + } + ]; + }; +}; + +private _fnc_selfReviveCountdownStop = { + removeMissionEventHandler ["EachFrame", _handlerCountdown]; + hintSilent ""; +}; + if (isPlayer _unit) then { _isPlayer = true; @@ -63,6 +99,7 @@ else { if (_isPlayer) then { [] call _fnc_applyPostEffect; + [] call _fnc_selfReviveCountdownStart; }; _unit setFatigue 1; @@ -175,7 +212,8 @@ if (_isPlayer and (_unit getVariable ["respawn",false])) exitWith {}; if (time > _bleedOut) exitWith { if (_isPlayer) then { - _unit call A3A_fnc_respawn + _unit call A3A_fnc_respawn; + [] call _fnc_selfReviveCountdownStop; } else { _unit setDamage 1; @@ -186,6 +224,7 @@ if (alive _unit) then { _unit setUnconscious false; _unit switchMove "unconsciousoutprone"; _unit setBleedingRemaining 0; + [] call _fnc_selfReviveCountdownStop; if (isPlayer _unit) then { [] call SCRT_fnc_misc_updateRichPresence; diff --git a/A3A/addons/scrt/Stringtable.xml b/A3A/addons/scrt/Stringtable.xml index f70ff87e35..46e021c68b 100644 --- a/A3A/addons/scrt/Stringtable.xml +++ b/A3A/addons/scrt/Stringtable.xml @@ -9469,6 +9469,14 @@ <br/>Appuyez sur H pour résister. <br/>H키를 눌러 스스로 일어나십시오. + + Self-Revive Cooldown + 자가소생 쿨다운 + + + Available + 준비됨 + Access Vehicle Market Посмотреть чёрный рынок техники From f04e13d18a2826513fe6ee78c61b798ce038645c Mon Sep 17 00:00:00 2001 From: dayrain Date: Sat, 13 Jul 2024 08:55:02 +0900 Subject: [PATCH 2/6] Use the _unit variable for consistency Co-authored-by: Silence <78276788+SilenceIsFatto@users.noreply.github.com> --- A3A/addons/core/functions/Revive/fn_unconscious.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index 53755aac83..5294b1576a 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -18,7 +18,7 @@ private _fnc_applyPostEffect = { }; private _fnc_selfReviveCountdownStart = { - private _diff = (player getVariable ["A3A_selfReviveTimeout", -1]) - time; + private _diff = (_unit getVariable ["A3A_selfReviveTimeout", -1]) - time; private _initialCountDown = [_diff] call BIS_fnc_countDown; if (_diff > 0) then { From 7a9214491febc1c9a2fb48bdab509f9d71445092 Mon Sep 17 00:00:00 2001 From: dayrain Date: Sat, 13 Jul 2024 23:34:07 +0900 Subject: [PATCH 3/6] Fix self-revive cooldown doesn't disappear when respawn --- A3A/addons/core/functions/Revive/fn_unconscious.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index 5294b1576a..f7e7c523b5 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -198,6 +198,7 @@ if (_isPlayer) then { if (_isPlayer) then { (findDisplay 46) displayRemoveEventHandler ["KeyDown", respawnMenu]; [_unit,"remove"] remoteExec ["A3A_fnc_flagaction",0,_unit]; + [] call _fnc_selfReviveCountdownStop; } else { _unit stop false; From ee729555976feb95cc7f680536adb0c5c820357e Mon Sep 17 00:00:00 2001 From: dayrain Date: Sat, 13 Jul 2024 23:56:04 +0900 Subject: [PATCH 4/6] Using A3A_fnc_customHint instead hintSilent --- .../core/functions/Revive/fn_unconscious.sqf | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index f7e7c523b5..b6cf6d0b69 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -25,11 +25,12 @@ private _fnc_selfReviveCountdownStart = { _handlerCountdown = addMissionEventHandler [ "EachFrame", { - hintSilent parseText format[ - "%1
%2", + [ localize "STR_antistasi_actions_unconscious_self_withstand_countdown", - [(([0] call BIS_fnc_countdown) / 60) + .01, "HH:MM"] call BIS_fnc_timetostring - ] + format[ + [(([0] call BIS_fnc_countdown) / 60) + .01, "HH:MM"] call BIS_fnc_timetostring + ] + ] call A3A_fnc_customHint } ]; } @@ -37,11 +38,13 @@ private _fnc_selfReviveCountdownStart = { _handlerCountdown = addMissionEventHandler [ "EachFrame", { - hintSilent parseText format[ - "%1
%2", + [ localize "STR_antistasi_actions_unconscious_self_withstand_countdown", - localize "STR_antistasi_actions_unconscious_self_withstand_ready" - ] + format[ + "%1", + localize "STR_antistasi_actions_unconscious_self_withstand_ready" + ] + ] call A3A_fnc_customHint } ]; }; From 3979e69a028bb7814ae7ed04d0aefb98f52ae8b2 Mon Sep 17 00:00:00 2001 From: dayrain Date: Sat, 13 Jul 2024 23:58:43 +0900 Subject: [PATCH 5/6] Removed unnecessary code --- A3A/addons/core/functions/Revive/fn_unconscious.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index b6cf6d0b69..9d4e51b924 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -52,7 +52,6 @@ private _fnc_selfReviveCountdownStart = { private _fnc_selfReviveCountdownStop = { removeMissionEventHandler ["EachFrame", _handlerCountdown]; - hintSilent ""; }; if (isPlayer _unit) then { From db88bc87bea2ee9614b56aef5ceb47e3aa1f916b Mon Sep 17 00:00:00 2001 From: dayrain Date: Sun, 14 Jul 2024 09:59:15 +0900 Subject: [PATCH 6/6] Prevent customHint sound spamming --- A3A/addons/core/functions/Revive/fn_unconscious.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/A3A/addons/core/functions/Revive/fn_unconscious.sqf b/A3A/addons/core/functions/Revive/fn_unconscious.sqf index 9d4e51b924..f1c584b441 100644 --- a/A3A/addons/core/functions/Revive/fn_unconscious.sqf +++ b/A3A/addons/core/functions/Revive/fn_unconscious.sqf @@ -29,7 +29,8 @@ private _fnc_selfReviveCountdownStart = { localize "STR_antistasi_actions_unconscious_self_withstand_countdown", format[ [(([0] call BIS_fnc_countdown) / 60) + .01, "HH:MM"] call BIS_fnc_timetostring - ] + ], + true ] call A3A_fnc_customHint } ]; @@ -43,7 +44,8 @@ private _fnc_selfReviveCountdownStart = { format[ "%1", localize "STR_antistasi_actions_unconscious_self_withstand_ready" - ] + ], + true ] call A3A_fnc_customHint } ];