Switch to unit namespace, added !hasHatch condition

This commit is contained in:
BaerMitUmlaut 2015-10-28 17:13:05 +01:00
parent 2fe53431c7
commit a1d72b81bf
2 changed files with 9 additions and 8 deletions

View File

@ -70,5 +70,3 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
},
{false},
[209, [false, false, true]], false] call cba_fnc_addKeybind; //PageDown + ALT
GVAR(reenableNVGs) = false;

View File

@ -20,15 +20,18 @@
params ["_unit", "_cameraView"];
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
(assignedVehicleRole _unit) params ["_role", "_turretPath"];
if ((vehicle _unit == _unit) || {isTurnedOut _unit} || {_role == "cargo" && {!(isNil "_turretPath")}}) then {
if ((_cameraView == "GUNNER") && {currentVisionMode _unit > 0}) 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 {
_unit action ["NVGogglesOff", _unit];
GVAR(reenableNVGs) = true;
_unit setVariable [QGVAR(reenableNVGs), true];
} else {
if (GVAR(reenableNVGs) && {_cameraView != "GUNNER"}) then {
if (_unit getVariable [QGVAR(reenableNVGs), false] && {_cameraView != "GUNNER"}) then {
_unit action ["NVGoggles", _unit];
GVAR(reenableNVGs) = false;
_unit setVariable [QGVAR(reenableNVGs), false];
};
};
};