2015-02-10 04:22:10 +00:00
|
|
|
/*
|
|
|
|
* Author: KoffeinFlummi and Commy2
|
|
|
|
* Check if weapon optics changed and reset zeroing if needed
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Player <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-16 12:15:14 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
EXPLODE_1_PVT(_this,_player);
|
2015-01-16 12:15:14 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
private ["_newOptics", "_adjustment"];
|
2015-01-16 12:15:14 +00:00
|
|
|
|
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]
|
|
|
|
_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-04-11 12:02:44 +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;
|