hearing: tweaks

This commit is contained in:
Nicolás Badano 2015-01-13 23:07:50 -03:00
parent b9c2af8dfe
commit 319e772832

View File

@ -10,7 +10,6 @@ GVAR(newStrength) = 0;
// Spawn volume updating process
0 spawn {
while {true} do {
_player = ACE_player;
// Check if new noises increase deafness
if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then {
@ -31,23 +30,23 @@ GVAR(newStrength) = 0;
GVAR(currentDeafness) = GVAR(currentDeafness) - _recoverRate max 0;
// needed until Bohemia fixes playSound to actually use the second argument
_volume = (1 - GVAR(currentDeafness) max 0)^2 max 0.1;
_volume = (1 - GVAR(currentDeafness) max 0)^2 max 0.04;
// Earplugs reduce hearing 20%
if ([_player] call FUNC(hasEarPlugsIn)) then {
_volume = _volume min 0.8;
// Earplugs reduce hearing 50%
if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
_volume = _volume min 0.5;
};
// Reduce volume if player is unconscious
if (_player getVariable ["ACE_isUnconscious", false]) then {
if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
_volume = _volume min 0.4;
};
if (!(missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false])) then {
0.1 fadeSound _volume;
0.1 fadeSpeech _volume;
_player setVariable ["tf_globalVolume", _volume];
_player setVariable ["acre_sys_core_globalVolume", _volume];
ACE_player setVariable ["tf_globalVolume", _volume];
ACE_player setVariable ["acre_sys_core_globalVolume", _volume];
};
//hintSilent format ["GVAR(currentDeafness), _Volume = %1, %2", GVAR(currentDeafness), _volume];