2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
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
|
|
|
|
*/
|
|
|
|
|
2015-10-08 17:29:30 +00:00
|
|
|
params ["_unit", "_cameraView"];
|
2017-12-06 19:15:33 +00:00
|
|
|
TRACE_2("onCameraViewChanged",_unit,_cameraView);
|
|
|
|
|
|
|
|
// Refresh goggle effect (e.g. switching to vehicle's NVG)
|
2020-02-23 12:52:32 +00:00
|
|
|
call FUNC(refreshGoggleType);
|
2015-10-07 18:11:07 +00:00
|
|
|
|
2015-10-08 09:31:29 +00:00
|
|
|
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
|
2024-03-26 12:54:06 +00:00
|
|
|
if ((isNull objectParent _unit)
|
2015-10-28 16:13:05 +00:00
|
|
|
|| {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];
|
2015-10-28 16:13:05 +00:00
|
|
|
_unit setVariable [QGVAR(reenableNVGs), true];
|
2015-10-08 09:31:29 +00:00
|
|
|
} else {
|
2015-10-28 16:13:05 +00:00
|
|
|
if (_unit getVariable [QGVAR(reenableNVGs), false] && {_cameraView != "GUNNER"}) then {
|
2015-10-08 09:31:29 +00:00
|
|
|
_unit action ["NVGoggles", _unit];
|
2015-10-28 16:13:05 +00:00
|
|
|
_unit setVariable [QGVAR(reenableNVGs), false];
|
2015-10-08 09:31:29 +00:00
|
|
|
};
|
2015-10-07 18:11:07 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|