ACE3/addons/nightvision/functions/fnc_onVisionModeChanged.sqf

33 lines
803 B
Plaintext
Raw Normal View History

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