Hearing - Fix explosions from AI fire (#10204)

This commit is contained in:
PabstMirror 2024-08-14 16:30:13 -05:00 committed by GitHub
parent 3229336018
commit 3728bc4b8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,23 @@ if (isServer) then {
}] call CBA_fnc_addEventHandler;
};
["CBA_settingsInitialized", {
TRACE_1("settingInit - common",GVAR(enableCombatDeafness));
// Only install event handler if combat deafness is enabled
if (!GVAR(enableCombatDeafness)) exitWith {};
addMissionEventHandler ["ProjectileCreated", {
params ["_projectile"];
if (!local _projectile) exitWith {};
// Rockets only explode on local clients
_projectile addEventHandler ["Explode", {
[QGVAR(explosion), _this] call CBA_fnc_globalEvent;
}];
}];
}] call CBA_fnc_addEventHandler;
if (!hasInterface) exitWith {};
#include "initKeybinds.inc.sqf"
@ -27,7 +44,7 @@ GVAR(volumeAttenuation) = 1;
GVAR(lastPlayerVehicle) = objNull;
["CBA_settingsInitialized", {
TRACE_1("settingInit",GVAR(enableCombatDeafness));
TRACE_1("settingInit - client",GVAR(enableCombatDeafness));
// Only run PFEH and install event handlers if combat deafness is enabled
if (!GVAR(enableCombatDeafness)) exitWith {};
@ -92,17 +109,6 @@ GVAR(lastPlayerVehicle) = objNull;
call FUNC(updateHearingProtection);
}, true] call CBA_fnc_addPlayerEventHandler;
addMissionEventHandler ["ProjectileCreated", {
params ["_projectile"];
if (!local _projectile) exitWith {};
// Rockets only explode on local clients
_projectile addEventHandler ["Explode", {
[QGVAR(explosion), _this] call CBA_fnc_globalEvent;
}];
}];
// Update protection on possible helmet change
["loadout", LINKFUNC(updateHearingProtection), false] call CBA_fnc_addPlayerEventHandler;
}] call CBA_fnc_addEventHandler;