mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
4b42eb4385
* Merge ST Nightvision * Cleanup * Header cleanup * Add ace setting for fog * Cleanup debug * Manual merge refuel changes * Add new setting for effect scaling * Cleanup * Use ace_common_fnc_getZoom * Fix compat inheritance changes * Fix stringtable * Add category * Tidy function headers * Replace global event with remote event
47 lines
1.3 KiB
Plaintext
47 lines
1.3 KiB
Plaintext
/*
|
|
* Author: BaerMitUmlaut, Dslyecxi, PabstMirror
|
|
* Disables turning on NVGs while the player aims down his sight.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: New vision mode <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, 1] call ace_nightvision_fnc_onVisionModeChanged
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_unit", "_visionMode"];
|
|
TRACE_2("onVisionModeChanged",_unit,_visionMode);
|
|
|
|
// Start PFEH when entering night vision mode:
|
|
if (_visionMode == 1) then {
|
|
if (GVAR(PFID) == -1) then {
|
|
GVAR(running) = true;
|
|
[true] call FUNC(setupDisplayEffects);
|
|
[] call FUNC(refreshGoggleType);
|
|
GVAR(PFID) = [LINKFUNC(pfeh), 0, []] call CBA_fnc_addPerFrameHandler;
|
|
|
|
// Fade in from black when turning nvg on
|
|
QGVAR(turnOnEffect) cutText ["", "BLACK IN", 2.5];
|
|
};
|
|
};
|
|
|
|
// Handle disableNVGsWithSights setting:
|
|
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") && {_visionMode > 0}) then {
|
|
_unit action ["NVGogglesOff", _unit];
|
|
};
|
|
};
|
|
};
|