ACE3/addons/nightvision/functions/fnc_onVisionModeChanged.sqf
2015-10-28 17:15:46 +01:00

33 lines
803 B
Plaintext

/*
* Author: BaerMitUmlaut
* Disables turning on NVGs while the player aims down his sight.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: New vision mode <NUMBER>
*
* Return Value:
* None
*
* Example:
* [player, 1] call ace_nightvision_fnc_onVisionModeChanged
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_visionMode"];
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
if ((vehicle _unit == _unit)
|| {isTurnedOut _unit}
|| {!([_unit] call EFUNC(common,hasHatch))
&& {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))}
}) then {
if ((cameraView == "GUNNER") && {_visionMode > 0}) then {
_unit action ["NVGogglesOff", _unit];
};
};
};