ACE3/addons/nightvision/functions/fnc_onCameraViewChanged.sqf

39 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-10-07 18:11:07 +00:00
/*
* Author: BaerMitUmlaut
2015-10-08 17:29:30 +00:00
* Disables/re-enables NVGs when the player starts/stops aiming 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 camera view <STRING>
2015-10-07 18:11:07 +00:00
*
* Return Value:
* None
*
* Example:
2015-10-08 17:29:30 +00:00
* [player, "GUNNER"] call ace_nightvision_fnc_onCameraViewChanged
2015-10-07 18:11:07 +00:00
*
* Public: No
*/
#include "script_component.hpp"
2015-10-08 17:29:30 +00:00
params ["_unit", "_cameraView"];
2015-10-07 18:11:07 +00:00
2015-10-08 09:31:29 +00:00
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") && {currentVisionMode _unit == 1}) then {
2015-10-08 09:31:29 +00:00
_unit action ["NVGogglesOff", _unit];
_unit setVariable [QGVAR(reenableNVGs), true];
2015-10-08 09:31:29 +00:00
} else {
if (_unit getVariable [QGVAR(reenableNVGs), false] && {_cameraView != "GUNNER"}) then {
2015-10-08 09:31:29 +00:00
_unit action ["NVGoggles", _unit];
_unit setVariable [QGVAR(reenableNVGs), false];
2015-10-08 09:31:29 +00:00
};
2015-10-07 18:11:07 +00:00
};
};
};