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 <jonpas33@gmail.com>

* 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 <jonpas33@gmail.com>
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Serg Vergun 2021-10-11 08:35:21 +03:00 committed by GitHub
parent 0d34ac2838
commit 128ddf2591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -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]

View File

@ -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;

View File

@ -524,5 +524,13 @@
<Chinese>強制顯示在準心指到和按按鍵時</Chinese>
<Turkish>Göstermeyi Yalnızca İmleç ve Tuşa Basmaya Zorla</Turkish>
</Key>
<Key ID="STR_ACE_NameTags_AmbientBrightnessAffectsViewDist_DisplayName">
<English>Nametag Ambient Brightness Coefficient</English>
<Russian>Коэффициент окружающего освещения для меток игроков</Russian>
</Key>
<Key ID="STR_ACE_NameTags_AmbientBrightnessAffectsViewDist_Description">
<English>Adjusts how strongly ambient brightness affects nametag view distance.</English>
<Russian>Определяет как сильно окружающее освещение влияет на дальность отображения меток игроков.</Russian>
</Key>
</Package>
</Project>