From 057be50cf6409133a5da98256a8135b4a03c298b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Wed, 14 Jan 2015 00:08:17 -0300 Subject: [PATCH] hearing: skip first execution of the PFH --- addons/hearing/functions/fnc_earRinging.sqf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index 52e1ac69fc..cfc91d1ebe 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -25,23 +25,25 @@ GVAR(newStrength) = GVAR(newStrength) max _strength; if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; _fnc_removeEarRinging = { + // Skip first execution + if (diag_tickTime > 1 + ((_this select 0) select 0)) exitWith {}; + GVAR(isEarRingingPlaying) = false; - // Delete this PFH, so it is only executed once [(_this select 1)] call cba_fnc_removePerFrameHandler; }; if (_strength > 0.75) exitWith { playSound "ACE_EarRinging_Heavy"; GVAR(isEarRingingPlaying) = true; - [_fnc_removeEarRinging, 7.0, [] ] call CBA_fnc_addPerFrameHandler; + [_fnc_removeEarRinging, 7.0, [diag_tickTime] ] call CBA_fnc_addPerFrameHandler; }; if (_strength > 0.5) exitWith { playSound "ACE_EarRinging_Medium"; GVAR(isEarRingingPlaying) = true; - [_fnc_removeEarRinging, 5.0, [] ] call CBA_fnc_addPerFrameHandler; + [_fnc_removeEarRinging, 5.0, [diag_tickTime] ] call CBA_fnc_addPerFrameHandler; }; if (_strength > 0.2) exitWith { playSound "ACE_EarRinging_Weak"; GVAR(isEarRingingPlaying) = true; - [_fnc_removeEarRinging, 3.0, [] ] call CBA_fnc_addPerFrameHandler; + [_fnc_removeEarRinging, 3.0, [diag_tickTime] ] call CBA_fnc_addPerFrameHandler; };