Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optics - Add scripted optics index config entry #1678

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions addons/optics/fnc_setOpticMagnification.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Author:
if (!isNil {parsingNamespace getVariable QGVAR(magnification)}) exitWith {};

params ["_unit", "_magnification"];
private _weapon = currentWeapon _unit;
private _optic = _unit call FUNC(currentOptic);

// store zeroing
private _zeroing = GVAR(ZeroingDistances) find currentZeroing _unit;
Expand All @@ -36,14 +34,14 @@ if (_zeroing isEqualTo -1) then {

parsingNamespace setVariable [QGVAR(magnification), _magnification];
parsingNamespace setVariable [QGVAR(zeroing), _zeroing];
_unit addWeaponItem [_weapon, _optic];
_unit setOpticsMode GVAR(scriptedOpticsIndex);

[{
params ["_unit", "_weapon", "_optic"];
params ["_unit", "_opticsMode"];

parsingNamespace setVariable [QGVAR(magnification), nil];
_unit addWeaponItem [_weapon, _optic];
_unit setOpticsMode _opticsMode;
parsingNamespace setVariable [QGVAR(zeroing), nil];
}, [_unit, _weapon, _optic]] call CBA_fnc_execNextFrame;
}, [_unit, GVAR(scriptedOpticsIndex)]] call CBA_fnc_execNextFrame;

// @todo, rifle, pistol, launcher, plus optics
2 changes: 2 additions & 0 deletions addons/optics/fnc_updateOpticInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ GVAR(ppEffects) = getArray (_config >> "opticsPPEffects") apply {
GVAR(hideMagnification) = getNumber (_config >> "hideMagnification") != 0;
GVAR(disableTilt) = getNumber (_config >> "disableTilt") != 0;

GVAR(scriptedOpticsIndex) = getNumber (_config >> "scriptedOpticsIndex");

[uiNamespace getVariable QGVAR(ScriptedOpticDisplay), false] call FUNC(loadScriptedOptic);

//INFO_1("Updated optic info %1.",_optic);
Expand Down