ACE3/addons/nightvision/functions/fnc_onCameraViewChanged.sqf

36 lines
1005 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/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 {
(assignedVehicleRole _unit) params ["_role", "_turretPath"];
if ((vehicle _unit == _unit) || {isTurnedOut _unit} || {_role == "cargo" && {!(isNil "_turretPath")}}) then {
2015-10-08 17:29:30 +00:00
if ((_cameraView == "GUNNER") && {currentVisionMode _unit > 0}) then {
2015-10-08 09:31:29 +00:00
_unit action ["NVGogglesOff", _unit];
GVAR(reenableNVGs) = true;
} else {
2015-10-08 17:29:30 +00:00
if (GVAR(reenableNVGs) && {_cameraView != "GUNNER"}) then {
2015-10-08 09:31:29 +00:00
_unit action ["NVGoggles", _unit];
GVAR(reenableNVGs) = false;
};
2015-10-07 18:11:07 +00:00
};
};
};