From 50da8341cdb289be27db4853b6f25a10bef8bed6 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:22:23 +0200 Subject: [PATCH] Variable for repeated locality check --- addons/scopes/functions/fnc_getCurrentZeroRange.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf index c346767fb7..2c78e9e402 100644 --- a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf +++ b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf @@ -27,7 +27,9 @@ if (GVAR(simplifiedZeroing)) exitWith { ((_adjustment select _weaponIndex) select 0) }; -private _optic = if (_unit == ACE_Player) then { +private _local = (_unit == ACE_Player); + +private _optic = if (_local) then { GVAR(Optics) select _weaponIndex; } else { ([_unit] call FUNC(getOptics)) select _weaponIndex; @@ -35,7 +37,7 @@ private _optic = if (_unit == ACE_Player) then { private _opticConfig = if (_optic != "") then { (configFile >> "CfgWeapons" >> _optic) } else { - if (_unit == ACE_Player) then { + if (_local) then { (configFile >> "CfgWeapons" >> (GVAR(Guns) select _weaponIndex)) } else { private _gun = switch (_weaponIndex) do {