ACE3/addons/nightvision/functions/fnc_changeNVGBrightness.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

42 lines
1.3 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Change the brightness of the unit's NVG.
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Change in brightness (1 or -1) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [player, 1] call ace_nightvision_fnc_changeNVGBrightness
*
* Public: No
*/
params ["_player", "_changeInBrightness"];
TRACE_2("changeNVGBrightness",_player,_changeInBrightness);
private _effectsEnabled = GVAR(effectScaling) != 0;
private _defaultBrightness = [-3, 0] select _effectsEnabled;
private _brightness = _player getVariable [QGVAR(NVGBrightness), _defaultBrightness];
_brightness = ((_brightness + _changeInBrightness) min 0) max -6;
_player setVariable [QGVAR(NVGBrightness), _brightness, false];
// Display default setting as 0
[format [LLSTRING(NVGBrightness), _brightness - _defaultBrightness]] call EFUNC(common,displayTextStructured);
playSound "ACE_Sound_Click";
// Handle brightness only if effects are disabled
if (!_effectsEnabled) exitWith {
_brightness = linearConversion [-6, 0, _brightness, 0.4, 1.6, true];
GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, _brightness, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
GVAR(ppEffectNVGBrightness) ppEffectCommit 0;
};
// Trigger full ppEffects update next time run in the PFEH
GVAR(nextEffectsUpdate) = -1;