mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:33:29 +00:00
added function to handle names for vehicles
This commit is contained in:
@@ -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";
|
||||
};
|
||||
|
||||
@@ -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
|
||||
17
addons/main/functions/extract_data/fn_shorten_name.sqf
Normal file
17
addons/main/functions/extract_data/fn_shorten_name.sqf
Normal 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]
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user