From 5b3df2bcf7d621401453ae6795171ad6d407738e Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:50:35 -0300 Subject: [PATCH] Apply the ufeh to ACE_Optics --- addons/optics/CfgEventHandlers.hpp | 8 -------- addons/optics/XEH_postInit.sqf | 5 ++++- addons/optics/functions/fnc_handleFired.sqf | 16 ++++------------ 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 68962af2c4..e75956f440 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class AGM_Optics { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call DFUNC(handleFired)};); - }; - }; -}; diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index 2048db76c6..c9667f3931 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -10,7 +10,7 @@ GVAR(camera) = objNull; if ((!isNil {is3DEN}) && {is3DEN}) exitWith { ACE_LOGINFO("Eden detected: disabling Optics PIP Camera"); }; - + waitUntil {!isNull ACE_player}; waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; @@ -50,3 +50,6 @@ GVAR(camera) = objNull; GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; }; }] call EFUNC(common,addEventHandler); + +// Register fire event handler +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index f0399c37fc..299b2c30f4 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -2,26 +2,18 @@ * Original Author: Taosenai * Adapted By: KoffeinFlummi, commy2 * - * Animates the scope when firing. + * Animates the scope when firing. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit (Object) - * 1: Weapon (String) - * 2: Muzzle (String) - * 3: Mode (String) - * 4: Ammo (Object) - * 5: Magazine (String) - * 6: Projectile (Object) + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None */ #include "script_component.hpp" -private ["_unit", "_weapon"]; - -_unit = _this select 0; -_weapon = _this select 1; +//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); // check if compatible scope is used private "_display";