From 128ddf2591acc9842a5e80071189876afed70ded Mon Sep 17 00:00:00 2001 From: Serg Vergun <1197314+severgun@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:35:21 +0300 Subject: [PATCH] Nametags - Add setting to disable effect of ambient brightness on view distance (#8325) * Add setting to disable effect of ambient brightness on view dist * Add periods and Title Case for English localization * Apply suggested code. Make it more readable Co-authored-by: jonpas * fix spelling * fix mistype * one more mistype * Implement suggestions Settings parameter as slider. English and Russian localization. * Update addons/nametags/functions/fnc_getCachedFlags.sqf Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> Co-authored-by: jonpas Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/nametags/functions/fnc_getCachedFlags.sqf | 10 ++++++++-- addons/nametags/initSettings.sqf | 9 +++++++++ addons/nametags/stringtable.xml | 8 ++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/addons/nametags/functions/fnc_getCachedFlags.sqf b/addons/nametags/functions/fnc_getCachedFlags.sqf index 3fc13256e0..979517f6a0 100644 --- a/addons/nametags/functions/fnc_getCachedFlags.sqf +++ b/addons/nametags/functions/fnc_getCachedFlags.sqf @@ -50,7 +50,13 @@ switch (GVAR(showPlayerNames)) do { }; }; -private _ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0, 0.4] select ((currentVisionMode ace_player) != 0))) min 1) max 0; -private _maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance); +private _maxDistance = GVAR(playerNamesViewDistance); +if (GVAR(ambientBrightnessAffectViewDist) != 0) then { + private _ambientBrightness = [] call EFUNC(common,ambientBrightness); + if (currentVisionMode ace_player != 0) then { + _ambientBrightness = _ambientBrightness + 0.4; + }; + _maxDistance = _maxDistance * linearConversion [0, 1, _ambientBrightness, 1 - GVAR(ambientBrightnessAffectViewDist), 1, true]; +}; [_drawName, GVAR(showPlayerRanks),_enabledTagsNearby,_enabledTagsCursor,_maxDistance] diff --git a/addons/nametags/initSettings.sqf b/addons/nametags/initSettings.sqf index edabaa002f..129ed9511c 100644 --- a/addons/nametags/initSettings.sqf +++ b/addons/nametags/initSettings.sqf @@ -54,3 +54,12 @@ false, // isGlobal {[QGVAR(nametagColorYellow), _this] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; + +[ + QGVAR(ambientBrightnessAffectViewDist), + "SLIDER", + [LSTRING(AmbientBrightnessAffectsViewDist_DisplayName), LSTRING(AmbientBrightnessAffectsViewDist_Description)], + format ["ACE %1", localize LSTRING(Module_DisplayName)], + [0, 1, 1, 0, true], + true +] call CBA_fnc_addSetting; diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 263f093e0a..831ef49a8e 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -524,5 +524,13 @@ 強制顯示在準心指到和按按鍵時 Göstermeyi Yalnızca İmleç ve Tuşa Basmaya Zorla + + Nametag Ambient Brightness Coefficient + Коэффициент окружающего освещения для меток игроков + + + Adjusts how strongly ambient brightness affects nametag view distance. + Определяет как сильно окружающее освещение влияет на дальность отображения меток игроков. +