Merge branch 'short_name'

This commit is contained in:
Valmo Trindade
2025-03-21 18:46:33 -03:00
3 changed files with 26 additions and 5 deletions

View File

@@ -43,6 +43,10 @@ class CfgFunctions {
class extract_uuid {
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_uuid.sqf";
};
class shorten_name {
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_shorten_name.sqf";
};
class convert_location {
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_location.sqf";
};

View File

@@ -7,7 +7,7 @@ params["_unit"];
private _callsign = "";
if (roleDescription _unit != "") then {
_callsign = name _unit + " | " + roleDescription _unit;
_callsign = ([name _unit] call armatak_fnc_shorten_name) + " | " + roleDescription _unit;
} else {
_callsign = name _unit;
@@ -20,7 +20,7 @@ if ((([_unit] call BIS_fnc_objectType) select 0) == "Vehicle") then {
_callsign = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
if (!isNull driver _unit) then {
_callsign = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName") + " | " + name (driver _unit);
_callsign = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName") + " | " + ([name (driver _unit)] call armatak_fnc_shorten_name);
};
};
@@ -34,10 +34,10 @@ if (unitIsUAV _unit) then {
}
};
_pre_defined_callsign = _unit getVariable "_atak_callsign";
_atak_pre_defined_callsign = _unit getVariable "_atak_callsign";
if (!isNil "_pre_defined_callsign") then {
_callsign = _pre_defined_callsign;
if (!isNil "_atak_pre_defined_callsign") then {
_callsign = _atak_pre_defined_callsign;
};
_callsign

View File

@@ -0,0 +1,17 @@
params ["_fullName"];
private _nameParts = _fullName splitString " ";
private _nameCount = count _nameParts;
if (_nameCount == 1) then {
_fullName
} else {
private _firstName = _nameParts select 0;
private _lastName = _nameParts select (_nameCount - 1);
if ((count _lastName) >= 7) then {
_lastName
} else {
format ["%1 %2", _firstName select [0, 1], _lastName]
};
};