diff --git a/addons/winddeflection/CfgEventHandlers.hpp b/addons/winddeflection/CfgEventHandlers.hpp index a835fd0e88..917a0acbd7 100644 --- a/addons/winddeflection/CfgEventHandlers.hpp +++ b/addons/winddeflection/CfgEventHandlers.hpp @@ -8,10 +8,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - firedBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf index ff9e2427f4..14b4db1def 100644 --- a/addons/winddeflection/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_postInit.sqf @@ -8,6 +8,15 @@ GVAR(trackedBullets) = []; //If not enabled, dont't add PFEH if (!GVAR(enabled)) exitWith {}; + // Register fire event handler + ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + + if (GVAR(vehicleEnabled)) then { + ["firedPlayerVehicle", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + }; + [] call FUNC(updateTrajectoryPFH); }] call EFUNC(common,addEventHandler); diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index a3c51054ee..6910d4e830 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -1,15 +1,9 @@ /* * Author: Glowbal, Ruthberg - * Handles wind deflection for projectiles. + * Handles wind deflection for projectiles. Called from the unified fired EH only for players on foot and their vehicles if required by settings. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,17 +15,12 @@ */ #include "script_component.hpp" -params ["_unit", "", "", "", "_ammo", "", "_bullet"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; -if (!hasInterface) exitWith {false}; -if (!(GVAR(enabled))) exitWith {false}; -if (!(GVAR(vehicleEnabled)) && !(_unit isKindOf "Man")) exitWith {false}; if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false}; GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; - -true; \ No newline at end of file