Cargo - Add item index and damage to cargo menu (#9655)

* add index and damage to cargo menu

* Update addons/cargo/functions/fnc_onMenuOpen.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/cargo/functions/fnc_onMenuOpen.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

---------

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
Grim 2023-11-20 22:46:16 -03:00 committed by GitHub
parent 99ccf31807
commit 3904240153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,19 +64,24 @@ if (GVAR(interactionParadrop)) then {
private _displayName = "";
private _itemSize = 0;
private _index = -1;
private _damageStr = "0%";
private _damage = 0;
{
_displayName = [_x, true] call FUNC(getNameItem);
_itemSize = _x call FUNC(getSizeItem);
_damage = if (_x isEqualType "") then {0} else {damage _x};
_damageStr = ((_damage * 100) toFixed 0) + "%";
if (_itemSize >= 0) then {
_index = if (GVAR(interactionParadrop)) then {
_ctrl lbAdd format ["%1 (%2s)", _displayName, GVAR(paradropTimeCoefficent) * _itemSize]
_ctrl lbAdd format ["%1. %2 (%3s)", _forEachIndex + 1, _displayName, GVAR(paradropTimeCoefficent) * _itemSize]
} else {
_ctrl lbAdd _displayName
_ctrl lbAdd format ["%1. %2", _forEachIndex + 1, _displayName]
};
_ctrl lbSetTooltip [_index, format [LLSTRING(sizeMenu), _itemSize]];
private _tooltip = format ["%1\n%2", format [LLSTRING(sizeMenu), _itemSize], format ["%1: %2", localize "str_a3_normaldamage1", _damageStr]];
_ctrl lbSetTooltip [_index, _tooltip];
} else {
// If item has a size < 0, it means it's not loadable
_index = _ctrl lbAdd _displayName;