ACE3/addons/hearing/functions/fnc_earRinging.sqf

40 lines
1010 B
Plaintext
Raw Normal View History

/*
2015-06-13 15:16:18 +00:00
* Author: KoffeinFlummi, commy2, Rocko, Rommel, Ruthberg
* Ear ringing PFH
*
* Arguments:
2015-06-13 15:16:18 +00:00
* 0: unit <OBJECT>
2015-03-15 21:40:47 +00:00
* 1: strength of ear ringing (Number between 0 and 1) <NUMBER>
*
* Return Value:
2015-03-15 21:40:47 +00:00
* None
*
* Example:
2015-06-13 15:16:18 +00:00
* [_unit, _strength] call ace_hearing_fnc_earRinging
2015-03-15 21:40:47 +00:00
*
* Public: No
*/
2015-01-14 01:41:53 +00:00
#include "script_component.hpp"
2015-08-13 21:42:20 +00:00
params ["_unit", "_strength"];
2015-07-11 02:01:32 +00:00
if (_unit != ACE_player) exitWith {};
2015-06-13 15:16:18 +00:00
if (_strength < 0.05) exitWith {};
2015-07-13 19:01:41 +00:00
if (!isNull curatorCamera) exitWith {};
2015-08-08 19:40:19 +00:00
if ((!GVAR(enabledForZeusUnits)) && {player != ACE_player}) exitWith {};
2015-01-13 04:17:52 +00:00
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
2015-03-15 21:40:47 +00:00
_strength = _strength / 4;
};
2015-07-01 19:21:09 +00:00
//headgear hearing protection
if(headgear _unit != "") then {
2016-01-20 23:19:08 +00:00
private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1;
2015-07-01 19:21:09 +00:00
if(_protection > 0) then {
_strength = _strength * (1 - _protection);
};
};
2016-01-20 23:19:08 +00:00
TRACE_2("adding",_strength,GVAR(deafnessDV));
2015-07-11 02:01:32 +00:00
GVAR(deafnessDV) = GVAR(deafnessDV) + _strength;