2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: KoffeinFlummi, commy2
|
|
|
|
*
|
|
|
|
* Creates ear ringing effect with set strength.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: strength of ear ringing (Number between 0 and 1)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* none
|
|
|
|
*/
|
2015-01-14 01:41:53 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_unit", "_strength"];
|
|
|
|
|
|
|
|
_unit = _this select 0;
|
|
|
|
_strength = _this select 1;
|
|
|
|
|
2015-01-13 04:17:52 +00:00
|
|
|
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
|
2015-01-11 16:42:31 +00:00
|
|
|
_strength = _strength / 4;
|
|
|
|
};
|
|
|
|
|
2015-01-13 04:17:52 +00:00
|
|
|
GVAR(newStrength) = GVAR(newStrength) max _strength;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-13 04:17:52 +00:00
|
|
|
if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-14 02:34:55 +00:00
|
|
|
_fnc_removeEarRinging = {
|
2015-01-17 05:24:28 +00:00
|
|
|
EXPLODE_2_PVT(_this,_params,_pfhId);
|
|
|
|
EXPLODE_2_PVT(_params,_startTime,_duration);
|
|
|
|
|
|
|
|
// Exit if the delay is not met yet
|
|
|
|
if (time < _startTime + _duration) exitWith {};
|
2015-01-14 03:08:17 +00:00
|
|
|
|
2015-01-14 02:34:55 +00:00
|
|
|
GVAR(isEarRingingPlaying) = false;
|
2015-01-17 05:24:28 +00:00
|
|
|
[_pfhId] call cba_fnc_removePerFrameHandler;
|
2015-01-14 02:34:55 +00:00
|
|
|
};
|
|
|
|
|
2015-01-14 03:29:01 +00:00
|
|
|
if (profileNamespace getVariable [QGVAR(DisableEarRinging), false]) exitWith {};
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
if (_strength > 0.75) exitWith {
|
2015-01-13 04:17:52 +00:00
|
|
|
playSound "ACE_EarRinging_Heavy";
|
|
|
|
GVAR(isEarRingingPlaying) = true;
|
2015-01-17 05:24:28 +00:00
|
|
|
[_fnc_removeEarRinging, 0.25, [time, 7.0] ] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
if (_strength > 0.5) exitWith {
|
2015-01-13 04:17:52 +00:00
|
|
|
playSound "ACE_EarRinging_Medium";
|
|
|
|
GVAR(isEarRingingPlaying) = true;
|
2015-01-17 05:24:28 +00:00
|
|
|
[_fnc_removeEarRinging, 0.25, [time, 5.0] ] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
if (_strength > 0.2) exitWith {
|
2015-01-13 04:17:52 +00:00
|
|
|
playSound "ACE_EarRinging_Weak";
|
|
|
|
GVAR(isEarRingingPlaying) = true;
|
2015-01-17 05:24:28 +00:00
|
|
|
[_fnc_removeEarRinging, 0.25, [time, 3.0] ] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|