Nametags - Adjustable colors settings (#6641)

* Move hard coded nametag team colors to settings

Also made the default colors lighter to make them easier to read

* Added myself to contributors

* Fixed Nametag to Name Tag

* Optimized array copying

* Moved team color settings to color subcategory and used vanilla localization strings

* Split a long line into a more readable multiline solution
This commit is contained in:
zharf 2018-11-17 05:30:46 +02:00 committed by PabstMirror
parent 8119e87aa0
commit e00723039b
5 changed files with 70 additions and 7 deletions

View File

@ -65,6 +65,7 @@ Drill <drill87@gmail.com>
Dudakov aka [OMCB]Kaban <dudakov.s@gmail.com> Dudakov aka [OMCB]Kaban <dudakov.s@gmail.com>
Drofseh <drofseh@gmail.com> Drofseh <drofseh@gmail.com>
Dslyecxi <dslyecxi@gmail.com> Dslyecxi <dslyecxi@gmail.com>
Eclipser <jms@modeemi.fi>
ElTyranos ElTyranos
eRazeri eRazeri
evromalarkey <evromalarkey@gmail.com> evromalarkey <evromalarkey@gmail.com>

View File

@ -1,10 +1,6 @@
class ACE_Settings { class ACE_Settings {
class GVAR(defaultNametagColor) { class GVAR(defaultNametagColor) {
value[] = {0.77, 0.51, 0.08, 1}; movedToSQF = 1;
typeName = "COLOR";
isClientSettable = 1;
displayName = CSTRING(DefaultNametagColor);
category = CSTRING(Module_DisplayName);
}; };
class GVAR(showPlayerNames) { class GVAR(showPlayerNames) {
value = 1; value = 1;

View File

@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
#include "initSettings.sqf"
ADDON = true; ADDON = true;

View File

@ -57,10 +57,18 @@ _fnc_parameters = {
private _color = [1, 1, 1, _alpha]; private _color = [1, 1, 1, _alpha];
if ((group _target) != (group _player)) then { if ((group _target) != (group _player)) then {
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings) _color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
_color set [3, (_color select 3) * _alpha];
} else { } else {
_color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find ([assignedTeam _target] param [0, "MAIN"])) max 0); _color = +([
GVAR(nametagColorMain),
GVAR(nametagColorRed),
GVAR(nametagColorGreen),
GVAR(nametagColorBlue),
GVAR(nametagColorYellow)
] select (
(["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find ([assignedTeam _target] param [0, "MAIN"])) max 0
));
}; };
_color set [3, (_color select 3) * _alpha];
private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);

View File

@ -0,0 +1,56 @@
// CBA Settings [ADDON: ace_nametags]:
[
QGVAR(defaultNametagColor), "COLOR",
[LSTRING(DefaultNametagColor)],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.77, 0.51, 0.08, 1],
false, // isGlobal
{[QGVAR(defaultNametagColor), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
[
QGVAR(nametagColorMain), "COLOR",
["str_team_main"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 1.00, 1.00, 1],
false, // isGlobal
{[QGVAR(nametagColorMain), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
[
QGVAR(nametagColorRed), "COLOR",
["str_team_red"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 0.67, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorRed), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
[
QGVAR(nametagColorGreen), "COLOR",
["str_team_green"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.67, 1.00, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorGreen), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
[
QGVAR(nametagColorBlue), "COLOR",
["str_team_blue"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.67, 0.67, 1.00, 1],
false, // isGlobal
{[QGVAR(nametagColorBlue), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
[
QGVAR(nametagColorYellow),
"COLOR",
["str_team_yellow"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 1.00, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorYellow), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;