fix(esx_inventory/client): stop overloading the menu usable flag

esx_menu_default treats usable == false as "this row cannot be submitted".
esx_inventory was filling the same field with its own meaning - whether an
item has a use callback - and set it to false for accounts, for weapons and
for every item without a registered callback.

The result was that pressing enter on cash, bank, dirty money, any weapon or
any non consumable item did nothing at all. buildItemActionMenu was never
reached, even though those entries carry canRemove and the submenu would have
offered give and throw.

The action menu needs the value for its own "use" entry, so it moves to a
separate canUse field. The weight row keeps usable = false, since not being
submittable is correct there.

Verified on artifact 25770. Before: enter on cash and on bread did nothing.
After: cash offers throw and return, bank offers only return because it is
not droppable, bread offers throw and return without a use entry, and the
weight row still cannot be selected.
This commit is contained in:
Selt
2026-07-27 04:20:19 +02:00
parent ca597cf6f4
commit a507ec6a31
+4 -5
View File
@@ -4,7 +4,8 @@
---@field icon string
---@field count number
---@field value string
---@field usable boolean
---@field canUse boolean?
---@field usable boolean?
---@field rare boolean
---@field canRemove boolean
---@field unselectable boolean?
@@ -34,7 +35,6 @@ local function appendAccounts(elements)
icon = "fas fa-money-bill-wave",
count = account.money,
value = account.name,
usable = false,
rare = false,
canRemove = canDrop
}
@@ -56,7 +56,7 @@ local function appendItems(elements)
icon = "fas fa-box",
count = item.count,
value = item.name,
usable = item.usable,
canUse = item.usable,
rare = item.rare,
canRemove = item.canRemove
}
@@ -83,7 +83,6 @@ local function appendLoadout(elements)
icon = "fas fa-gun",
count = 1,
value = weapon.name,
usable = false,
rare = false,
ammo = ammo,
canGiveAmmo = (weapon.ammo ~= nil),
@@ -119,7 +118,7 @@ end
---@return table
local function buildItemActionMenu(selected, playerNearby)
local elements2 = {}
if selected.usable then
if selected.canUse then
elements2[#elements2 + 1] = { action = "use", label = TranslateCap("use"), icon = "fas fa-utensils", type = selected.type, value = selected.value }
end
if selected.canRemove then