From cf9479efabbed227ee553af9f0b8a1edc24375e8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 20 Apr 2016 10:40:00 -0500 Subject: [PATCH] Non-hardcoded binocular / vector detection --- addons/advanced_ballistics/functions/fnc_handleFired.sqf | 2 +- addons/dagr/functions/fnc_menuInit.sqf | 2 +- addons/vector/functions/fnc_onKeyHold.sqf | 2 +- addons/vector/initKeybinds.sqf | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index aa6922946a..c73cbda3d7 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -88,7 +88,7 @@ if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { _bulletTraceVisible = false; if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { - if (currentWeapon ACE_player in ["ACE_Vector", "ACE_VectorDay", "Binocular", "Rangefinder", "Laserdesignator"]) then { + if ((currentWeapon ACE_player == binocular ACE_player) && {binocular ACE_player != ""}) then { _bulletTraceVisible = true; } else { if (currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then { diff --git a/addons/dagr/functions/fnc_menuInit.sqf b/addons/dagr/functions/fnc_menuInit.sqf index 471150dd1c..54cb4467c5 100644 --- a/addons/dagr/functions/fnc_menuInit.sqf +++ b/addons/dagr/functions/fnc_menuInit.sqf @@ -522,7 +522,7 @@ GVAR(menuRun) = true; (__dsp displayCtrl __mainText) ctrlSetText "Connecting..."; }; if (ACE_time - GVAR(busyTimer) > 0.6) then { - if ((ACE_player hasWeapon "ACE_Vector") || {ACE_player hasWeapon "ACE_VectorDay"}) then { + if (({_x isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]} count (weapons ACE_player)) > 0) then { GVAR(displaySelection) = "VECTOR"; (__dsp displayCtrl __mainText) ctrlSetText "Vector Connected"; GVAR(vectorConnected) = true; diff --git a/addons/vector/functions/fnc_onKeyHold.sqf b/addons/vector/functions/fnc_onKeyHold.sqf index b76fe0ad0c..517cf3ea37 100644 --- a/addons/vector/functions/fnc_onKeyHold.sqf +++ b/addons/vector/functions/fnc_onKeyHold.sqf @@ -7,7 +7,7 @@ PFH executed while holding a vector key down. */ #include "script_component.hpp" -if (!(currentWeapon ACE_player in ["ACE_Vector", "ACE_VectorDay"])) exitWith { +if (!((currentWeapon ACE_player) isKindOf ["ACE_Vector", configFile >> "CfgWeapons"])) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; GVAR(currentMode) = ""; diff --git a/addons/vector/initKeybinds.sqf b/addons/vector/initKeybinds.sqf index 0d4bb59d27..5b099235da 100644 --- a/addons/vector/initKeybinds.sqf +++ b/addons/vector/initKeybinds.sqf @@ -5,7 +5,7 @@ // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !((currentWeapon ACE_player in ["ACE_Vector", "ACE_VectorDay"]) && {cameraView == "GUNNER"}) exitWith {false}; + if !(((currentWeapon ACE_player) isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]) && {cameraView == "GUNNER"}) exitWith {false}; // prevent holding down if (GETGVAR(isDownStateKey1,false)) exitWith {false}; @@ -34,7 +34,7 @@ // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !((currentWeapon ACE_player in ["ACE_Vector", "ACE_VectorDay"]) && {cameraView == "GUNNER"}) exitWith {false}; + if !(((currentWeapon ACE_player) isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]) && {cameraView == "GUNNER"}) exitWith {false}; // prevent holding down if (GETGVAR(isDownStateKey2,false)) exitWith {false};