ACE3/addons/cargo/functions/fnc_getNameItem.sqf
johnb432 d1f0dc5e83
Cargo - Improve various aspects (#9617)
* Update CfgVehicles.hpp

* Cargo cleanup

* Update menu.hpp

* Updated status effect key

* Update fnc_onMenuOpen.sqf

* Update fnc_onMenuOpen.sqf

* fix comment from merge

* nil interaction GVARs on menu close

* fix carry bug

* Fix floating objects in MP

* Updated ace_cargoAdded doc

* Fix progress bar prematurely stopping

* Finer cursor object selection

---------

Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
2023-11-17 20:07:28 -03:00

36 lines
906 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: JasperRab
* Gets the name of the item, and alternatively the custom name if requested and available.
*
* Arguments:
* 0: Item <STRING> or <OBJECT> (default: "")
* 1: Add custom name <BOOL> (default: false)
*
* Return Value:
* Item name <STRING>
*
* Example:
* cursorObject call ace_cargo_fnc_getNameItem
*
* Public: Yes
*/
params [["_item", "", [objNull, ""]], ["_addCustomName", false, [false]]];
private _displayName = if (_item isEqualType "") then {
getText (configFile >> "CfgVehicles" >> _item >> "displayName")
} else {
getText (configOf _item >> "displayName")
};
if (_addCustomName && {_item isEqualType objNull}) then {
private _customName = _item getVariable [QGVAR(customName), ""];
if (_customName isNotEqualTo "") then {
_displayName = _displayName + " [" + _customName + "]";
};
};
_displayName