Merge pull request #4004 from acemod/custom-rank-icons-function

add function for custom rank icons displayed below nametags
This commit is contained in:
Glowbal 2016-06-26 10:57:49 +02:00 committed by GitHub
commit 21c4efcbba
15 changed files with 79 additions and 2 deletions

View File

@ -109,6 +109,7 @@ Riccardo Petricca <petriccarcc@gmail.com>
Robert Boklahánics <bokirobi@gmail.com>
ruPaladin <happyworm24@rambler.ru>
simon84 <badguy360th@gmail.com>
Skengman2
Sniperwolf572 <tenga6@gmail.com>
System98
SzwedzikPL <szwedzikpl@gmail.com>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

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

View File

@ -9,3 +9,9 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -0,0 +1,25 @@
#include "script_component.hpp"
private _russianRankIcons = [
QPATHTOEF(nametags,UI\icons_russia\private_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\corporal_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\sergeant_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\lieutenant_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\captain_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\major_gs.paa),
QPATHTOEF(nametags,UI\icons_russia\colonel_gs.paa)
];
{
[_x, _russianRankIcons] call EFUNC(nametags,setFactionRankIcons);
} forEach [
"rhs_faction_msv",
"rhs_faction_vdv",
"rhs_faction_vmf",
"rhs_faction_vv",
"rhs_faction_tv",
"rhs_faction_vpvo",
"rhs_faction_vvs",
"rhs_faction_vvs_c",
"rhs_faction_rva"
];

View File

@ -8,7 +8,7 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops", "rhs_c_bmd", "rhs_c_bmp", "rhs_c_bmp3", "rhs_c_a2port_armor", "rhs_c_btr", "rhs_c_sprut", "rhs_c_t72", "rhs_c_tanks", "rhs_c_a2port_air", "rhs_c_a2port_car", "rhs_c_cars", "rhs_c_2s3", "rhs_c_rva"};
author = ECSTRING(common,ACETeam);
authors[] = {"Ruthberg", "GitHawk", "BaerMitUmlaut"};
authors[] = {"Ruthberg", "GitHawk", "BaerMitUmlaut", "commy2", "Skengman2"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};