ACE3/addons/scopes/functions/fnc_inventoryCheck.sqf
ulteq fee65cd56f Overhauled the scope adjustment module:
*Added configs for the new marksmen scopes
*Introduced minor and major steps
*Introcuded a new increment config (ACE_ScopeAdjust_Increment)
*Changed the default zero range to 100m
*Added a zero reference setting
*Added an interaction menu entry to update the zero reference setting
2015-04-11 14:02:44 +02:00

44 lines
1.2 KiB
Plaintext

/*
* Author: KoffeinFlummi and Commy2
* Check if weapon optics changed and reset zeroing if needed
*
* Arguments:
* 0: Player <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_player);
private ["_newOptics", "_adjustment"];
_adjustment = ACE_player getVariable QGVAR(Adjustment);
if (isNil "_adjustment") then {
// [Windage, Elevation, Zero]
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
ACE_player setVariable [QGVAR(Adjustment), _adjustment];
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
};
if (isNil QGVAR(Optics)) then {
GVAR(Optics) = ["", "", ""];
};
_newOptics = [_player] call FUNC(getOptics);
{
if (_newOptics select _forEachIndex != _x) then {
// The optic for this weapon changed, set adjustment to zero
if !((_adjustment select _foreachindex) isEqualTo [0,0,0]) then {
_adjustment set [_forEachIndex, [0,0,0]];
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
};
};
} forEach GVAR(Optics);
_adjustment = ACE_player getVariable QGVAR(Adjustment);
GVAR(Optics) = _newOptics;