From 755f6bcc6bb09f52e94cb47f6232a9769b074e86 Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Jul 2016 16:14:16 +0200 Subject: [PATCH] Make hearing component compatible with glasses --- .../functions/fnc_updateHearingProtection.sqf | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/hearing/functions/fnc_updateHearingProtection.sqf b/addons/hearing/functions/fnc_updateHearingProtection.sqf index b1b7df48c5..fe0ca867ff 100644 --- a/addons/hearing/functions/fnc_updateHearingProtection.sqf +++ b/addons/hearing/functions/fnc_updateHearingProtection.sqf @@ -29,8 +29,16 @@ GVAR(volumeAttenuation) = [1, GVAR(EarplugsVolume)] select _hasEarPlugsIn; // Handle Headgear if (headgear ACE_player != "") then { - private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(protection))) min 1; + private _protection = getNumber (configFile >> "CfgWeapons" >> headgear ACE_player >> QGVAR(protection)) min 1; GVAR(damageCoefficent) = GVAR(damageCoefficent) * (1 - _protection); - private _attenuation = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(lowerVolume))) min 1; + private _attenuation = getNumber (configFile >> "CfgWeapons" >> headgear ACE_player >> QGVAR(lowerVolume)) min 1; + GVAR(volumeAttenuation) = GVAR(volumeAttenuation) * (1 - _attenuation); +}; + +// Handle Goggles +if (goggles ACE_player != "") then { + private _protection = getNumber (configFile >> "CfgGlasses" >> goggles ACE_player >> QGVAR(protection)) min 1; + GVAR(damageCoefficent) = GVAR(damageCoefficent) * (1 - _protection); + private _attenuation = getNumber (configFile >> "CfgGlasses" >> goggles ACE_player >> QGVAR(lowerVolume)) min 1; GVAR(volumeAttenuation) = GVAR(volumeAttenuation) * (1 - _attenuation); };