add function for custom rank icons displayed below nametags

This commit is contained in:
commy2 2016-06-25 21:25:03 +02:00
parent 8f3907c03f
commit e88ecfc236
5 changed files with 50 additions and 1 deletions

View File

@ -8,3 +8,4 @@ PREP(moduleNameTags);
PREP(onDraw3d);
PREP(setText);
PREP(updateSettings);
PREP(setFactionRankIcons);

View File

@ -5,6 +5,10 @@
if (!hasInterface) exitWith {};
if (isNil QGVAR(factionRanks)) then {
GVAR(factionRanks) = [] call CBA_fnc_createNamespace;
};
GVAR(showNamesTime) = -10;
// Add keybinds

View File

@ -37,7 +37,12 @@ _fnc_parameters = {
_size = 1;
} else {
if (_drawRank && {rank _target != ""}) then {
_icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", toLower rank _target];
_icon = GVAR(factionRanks) getVariable faction _target;
if (!isNil "_icon") then {
_icon = _icon param [ALL_RANKS find rank _target, ""];
} else {
_icon = format ["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", rank _target];
};
_size = 1;
};
};

View File

@ -0,0 +1,37 @@
/*
* Author: commy2
* Sets a custom set of icons for a specified faction.
*
* Arguments:
* 0: Faction <STRING>
* 1: Rank Icons <ARRAY>
*
* Return Value:
* Successful? <BOOLEAN>
*
* Example:
* ["BLU_F", [
* "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa",
* "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa"
* ] call ace_nametags_fnc_setFactionRankIcons
*
* Public: Yes
*/
#include "script_component.hpp"
if (isNil QGVAR(factionRanks)) then {
GVAR(factionRanks) = [] call CBA_fnc_createNamespace;
};
params [["_faction", "", [""]], ["_icons", [], [[]], [7]]];
if !(_faction != "" && {_icons isEqualTypeAll ""}) exitWith {false};
GVAR(factionRanks) setVariable [_faction, _icons];
true

View File

@ -22,3 +22,5 @@
#define ICON_NAME_RANK 2
#define ICON_NAME_SPEAK 3
#define ICON_SPEAK 4
#define ALL_RANKS ["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"]