ACE3/addons/hearing/XEH_postInit.sqf
2015-07-10 21:30:47 -05:00

40 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
if (!hasInterface) exitWith {};
GVAR(deafnessDV) = 0;
GVAR(deafnessPrior) = 0;
GVAR(playerVehAttenuation) = 1;
GVAR(beep) = false;
GVAR(beep2) = false;
GVAR(time2) = 0;
GVAR(time3) = 0;
GVAR(time4) = 0;
["SettingsInitialized", {
//If not enabled, dont't add draw eventhandler or PFEH (for performance)
if (!GVAR(enableCombatDeafness)) exitWith {};
// Spawn volume updating process
[FUNC(updateVolume), 1, [] ] call CBA_fnc_addPerFrameHandler;
}] call EFUNC(common,addEventHandler);
//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(beep) = false;
GVAR(beep2) = false;
GVAR(time2) = 0;
GVAR(time3) = 0;
GVAR(time4) = 0;
}] call EFUNC(common,addEventhandler);