mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add function for custom rank icons displayed below nametags
This commit is contained in:
parent
8f3907c03f
commit
e88ecfc236
@ -8,3 +8,4 @@ PREP(moduleNameTags);
|
||||
PREP(onDraw3d);
|
||||
PREP(setText);
|
||||
PREP(updateSettings);
|
||||
PREP(setFactionRankIcons);
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
if (isNil QGVAR(factionRanks)) then {
|
||||
GVAR(factionRanks) = [] call CBA_fnc_createNamespace;
|
||||
};
|
||||
|
||||
GVAR(showNamesTime) = -10;
|
||||
|
||||
// Add keybinds
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
37
addons/nametags/functions/fnc_setFactionRankIcons.sqf
Normal file
37
addons/nametags/functions/fnc_setFactionRankIcons.sqf
Normal 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
|
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user