2015-02-10 04:22:10 +00:00
|
|
|
/*
|
2015-08-07 14:43:06 +00:00
|
|
|
* Author: KoffeinFlummi, Commy2
|
2015-02-10 04:22:10 +00:00
|
|
|
* Check if weapon optics changed and reset zeroing if needed
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Player <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2015-08-07 14:43:06 +00:00
|
|
|
* Example:
|
|
|
|
* [player] call ace_scopes_fnc_inventoryCheck
|
|
|
|
*
|
2015-02-10 04:22:10 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-16 12:15:14 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
private ["_newOptics", "_adjustment"];
|
2015-01-16 12:15:14 +00:00
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
params ["_player"];
|
|
|
|
|
2015-02-10 02:00:40 +00:00
|
|
|
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
|
|
|
if (isNil "_adjustment") then {
|
2015-04-11 12:02:44 +00:00
|
|
|
// [Windage, Elevation, Zero]
|
2015-08-07 14:43:06 +00:00
|
|
|
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
2015-02-10 04:22:10 +00:00
|
|
|
ACE_player setVariable [QGVAR(Adjustment), _adjustment];
|
2015-02-12 15:21:46 +00:00
|
|
|
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
2015-01-16 12:15:14 +00:00
|
|
|
};
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
if (isNil QGVAR(Optics)) then {
|
|
|
|
GVAR(Optics) = ["", "", ""];
|
|
|
|
};
|
|
|
|
_newOptics = [_player] call FUNC(getOptics);
|
|
|
|
|
2015-01-16 12:15:14 +00:00
|
|
|
{
|
2015-02-10 04:22:10 +00:00
|
|
|
if (_newOptics select _forEachIndex != _x) then {
|
|
|
|
// The optic for this weapon changed, set adjustment to zero
|
2015-08-07 14:43:06 +00:00
|
|
|
if (!((_adjustment select _foreachindex) isEqualTo [0, 0, 0])) then {
|
|
|
|
_adjustment set [_forEachIndex, [0, 0, 0]];
|
2015-02-12 15:21:46 +00:00
|
|
|
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
2015-02-10 04:22:10 +00:00
|
|
|
};
|
2015-01-16 12:15:14 +00:00
|
|
|
};
|
|
|
|
} forEach GVAR(Optics);
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
|
|
|
GVAR(Optics) = _newOptics;
|