ACE3/addons/hearing/XEH_postInit.sqf

46 lines
1.6 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
2016-05-24 13:13:11 +00:00
["ace_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 {};
//Add XEH:
["CAManBase", "FiredNear", FUNC(firedNear)] call CBA_fnc_addClassEventHandler;
["CAManBase", "Explosion", FUNC(explosionNear)] call CBA_fnc_addClassEventHandler;
// 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
2016-05-24 13:13:11 +00:00
["ace_playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call CBA_fnc_addEventHandler;
["ace_playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call CBA_fnc_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 CBA_fnc_addEventHandler;
// Update protection on possible helmet change
2016-05-24 13:13:11 +00:00
["ace_playerInventoryChanged", {[] call FUNC(updateHearingProtection);}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;