2015-01-14 02:00:48 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-11 04:51:07 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2016-02-18 16:58:18 +00:00
|
|
|
GVAR(cacheAmmoLoudness) = call CBA_fnc_createNamespace;
|
2016-01-10 00:51:41 +00:00
|
|
|
|
2015-07-11 02:01:32 +00:00
|
|
|
GVAR(deafnessDV) = 0;
|
|
|
|
GVAR(deafnessPrior) = 0;
|
2015-07-12 02:00:40 +00:00
|
|
|
GVAR(volume) = 1;
|
2015-04-20 07:17:47 +00:00
|
|
|
GVAR(playerVehAttenuation) = 1;
|
2015-06-13 15:16:18 +00:00
|
|
|
GVAR(time3) = 0;
|
2016-02-17 00:17:42 +00:00
|
|
|
GVAR(damageCoefficent) = 1;
|
2016-02-18 16:48:40 +00:00
|
|
|
GVAR(volumeAttenuation) = 1;
|
2015-06-13 15:16:18 +00:00
|
|
|
|
2015-07-11 02:01:32 +00:00
|
|
|
["SettingsInitialized", {
|
2016-02-16 18:58:42 +00:00
|
|
|
TRACE_1("settingInit",GVAR(EnableCombatDeafness));
|
2016-02-17 00:17:42 +00:00
|
|
|
// Only run PFEH and install event handlers if combat deafness is enabled
|
2016-02-16 18:58:42 +00:00
|
|
|
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
|
|
|
|
2016-02-18 16:48:40 +00:00
|
|
|
// Update hearing protection now:
|
|
|
|
[] call FUNC(updateHearingProtection);
|
|
|
|
|
2015-07-11 02:01:32 +00:00
|
|
|
// Spawn volume updating process
|
2015-08-13 21:42:20 +00:00
|
|
|
[FUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler;
|
2015-04-11 04:21:54 +00:00
|
|
|
|
2016-02-18 16:48:40 +00:00
|
|
|
// Update veh attunation when player veh changes
|
2016-02-17 00:17:42 +00:00
|
|
|
["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler);
|
|
|
|
["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler);
|
|
|
|
|
2016-02-18 16:48:40 +00:00
|
|
|
// Reset deafness on respawn (or remote control player switch)
|
2016-02-17 00:17:42 +00:00
|
|
|
["playerChanged", {
|
|
|
|
GVAR(deafnessDV) = 0;
|
|
|
|
GVAR(deafnessPrior) = 0;
|
|
|
|
ACE_player setVariable [QGVAR(deaf), false];
|
|
|
|
GVAR(time3) = 0;
|
|
|
|
[] call FUNC(updateHearingProtection);
|
|
|
|
}] call EFUNC(common,addEventhandler);
|
|
|
|
|
2016-02-18 16:48:40 +00:00
|
|
|
// Update protection on possible helmet change
|
2016-02-17 00:17:42 +00:00
|
|
|
["playerInventoryChanged", {[] call FUNC(updateHearingProtection);}] call EFUNC(common,addEventhandler);
|
|
|
|
}] call EFUNC(common,addEventHandler);
|