Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nametags - Fix overlapping draw order #10680

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addons/nametags/functions/fnc_getCachedFlags.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ switch (GVAR(showPlayerNames)) do {
};

private _maxDistance = GVAR(playerNamesViewDistance);
private _sortByDistance = GVAR(playerNamesSortDistance);
if (GVAR(ambientBrightnessAffectViewDist) != 0) then {
private _ambientBrightness = [] call EFUNC(common,ambientBrightness);
if (currentVisionMode ace_player != 0) then {
Expand All @@ -59,4 +60,4 @@ if (GVAR(ambientBrightnessAffectViewDist) != 0) then {
_maxDistance = _maxDistance * linearConversion [0, 1, _ambientBrightness, 1 - GVAR(ambientBrightnessAffectViewDist), 1, true];
};

[_drawName, GVAR(showPlayerRanks),_enabledTagsNearby,_enabledTagsCursor,_maxDistance]
[_drawName, GVAR(showPlayerRanks),_enabledTagsNearby,_enabledTagsCursor,_maxDistance,_sortByDistance]
10 changes: 8 additions & 2 deletions addons/nametags/functions/fnc_onDraw3d.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if ((isNull ACE_player) || {!alive ACE_player} || {!isNull (findDisplay 49)}) ex

private _flags = [[], DFUNC(getCachedFlags), ACE_player, QGVAR(flagsCache), 2] call EFUNC(common,cachedCall);

_flags params ["_drawName", "_drawRank", "_enabledTagsNearby", "_enabledTagsCursor", "_maxDistance"];
_flags params ["_drawName", "_drawRank", "_enabledTagsNearby", "_enabledTagsCursor", "_maxDistance", "_sortByDistance"];

private _onKeyPressAlphaMax = 1;
if (GVAR(showPlayerNames) == 3) then {
Expand Down Expand Up @@ -78,7 +78,13 @@ if (_enabledTagsCursor) then {
if (_enabledTagsNearby) then {
// Find valid targets and cache them
private _targets = [[], {
private _nearMen = _camPosAGL nearObjects ["CAManBase", _maxDistance + 7];
private _nearMen = call ([
{_camPosAGL nearObjects ["CAManBase", _maxDistance + 7]},
{
private _unsortedObjects = nearestObjects [_camPosAGL, ["CAManBase"], _maxDistance + 7];
reverse _unsortedObjects;
_unsortedObjects;
}] select _sortByDistance);
_nearMen = _nearMen select {
_x != ACE_player &&
{(side group _x) == (side group ACE_player)} &&
Expand Down
8 changes: 8 additions & 0 deletions addons/nametags/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
1
] call CBA_fnc_addSetting;

[
QGVAR(playerNamesSortDistance), "CHECKBOX",
[LSTRING(playerNamesSortDistance_DisplayName), LSTRING(playerNamesSortDistance_Description)],
format ["ACE %1", localize LSTRING(Module_DisplayName)],
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved
true,
0
] call CBA_fnc_addSetting;

[
QGVAR(playerNamesMaxAlpha), "SLIDER",
LSTRING(playerNamesMaxAlpha),
Expand Down
6 changes: 6 additions & 0 deletions addons/nametags/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@
<Chinesesimp>玩家名称标签透明度</Chinesesimp>
<Turkish>Oyuncu etiketlerinde şeffaflık</Turkish>
</Key>
<Key ID="STR_ACE_NameTags_PlayerNamesSortDistance_Description">
<English>Sorts player names so closer player names are drawn first. Default: true</English>
</Key>
<Key ID="STR_ACE_NameTags_PlayerNamesSortDistance_DisplayName">
<English>Sort names by distance</English>
</Key>
<Key ID="STR_ACE_NameTags_PlayerNamesViewDistance_Description">
<English>Distance in meters at which player names are shown. Default: 5</English>
<Czech>Vzdálenost v metrech pro zobrazení jména. Výchozí: 5</Czech>
Expand Down
Loading