From 7ace1738c006eb5e036c26e7704ab2e350314de3 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:29:05 -0300 Subject: [PATCH] Apply the ufeh to ACE_HuntIr --- addons/huntir/CfgEventhandlers.hpp | 8 -------- addons/huntir/XEH_postInit.sqf | 5 +++++ addons/huntir/functions/fnc_handleFired.sqf | 15 ++++++--------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/addons/huntir/CfgEventhandlers.hpp b/addons/huntir/CfgEventhandlers.hpp index 308df09c1b..44b6e8e6ff 100644 --- a/addons/huntir/CfgEventhandlers.hpp +++ b/addons/huntir/CfgEventhandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; \ No newline at end of file diff --git a/addons/huntir/XEH_postInit.sqf b/addons/huntir/XEH_postInit.sqf index c5526500ac..0c518dfcea 100644 --- a/addons/huntir/XEH_postInit.sqf +++ b/addons/huntir/XEH_postInit.sqf @@ -7,3 +7,8 @@ GVAR(TI) = 0; GVAR(cur_cam) = 0; GVAR(ROTATE) = 0; GVAR(ELEVAT) = 0.01; + +// Register fire event handler +// Don't run for non players, as they are too dumb to launch huntirs anyway +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 1919b4547c..551b9975b6 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -1,16 +1,10 @@ /* * Author: Norrin, Rocko, Ruthberg * - * Handles HuntIR projectiles + * Handles HuntIR projectiles. Called from the unified fired EH for all CAManBase. * * 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: * None @@ -19,10 +13,13 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +//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 (_ammo != "F_HuntIR") exitWith {}; +if (!hasInterface) exitWith {}; + [{ params ["_projectile"];