ACE3/addons/hearing/XEH_postInit.sqf

42 lines
1.5 KiB
Plaintext
Raw Normal View History

2015-01-14 02:00:48 +00:00
#include "script_component.hpp"
2015-04-11 04:51:07 +00:00
if (!hasInterface) exitWith {};
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;
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;
GVAR(damageCoefficent) = 1;
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));
// Only run PFEH and install event handlers if combat deafness is enabled
2016-02-16 18:58:42 +00:00
if (!GVAR(EnableCombatDeafness)) exitWith {};
// 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
// Update veh attunation when player veh changes
["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler);
["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler);
// Reset deafness on respawn (or remote control player switch)
["playerChanged", {
GVAR(deafnessDV) = 0;
GVAR(deafnessPrior) = 0;
ACE_player setVariable [QGVAR(deaf), false];
GVAR(time3) = 0;
[] call FUNC(updateHearingProtection);
}] call EFUNC(common,addEventhandler);
// Update protection on possible helmet change
["playerInventoryChanged", {[] call FUNC(updateHearingProtection);}] call EFUNC(common,addEventhandler);
}] call EFUNC(common,addEventHandler);