core_inventory compatibility

The current implementation isn’t the cleanest, but it gets the job done. I’ve had to rig parts of it together, and it hasn’t yet had a proper cleanup pass. This update adds support for core_inventory on both ESX and QB frameworks. Previously, the QB fallback worked fine, but an issue affecting ESX users was discovered.

To resolve this, a change was needed in how framework-registered usable items are handled—allowing us to pass the item’s ID as the slot when using core_inventory, while maintaining slot-based behavior otherwise. This approach ensures compatibility without requiring any modifications to other resources.

I've personally tested this on ESX, but since I haven’t been able to coordinate with the core_inventory team, QB Core users will essentially be the first wave of testers for this integration.
This commit is contained in:
MrNewb committed 2025-05-06 14:39:29 -04:00
1 parent afb0e6b45e
commit 11114bf529
5 files changed
+146

No files matched your search

+1
View File
@@ -447,6 +447,7 @@ Framework.RegisterUsableItem = function(itemName, cb)
local func = function(src, item, itemData)
itemData = itemData or item
itemData.metadata = itemData.metadata or itemData.info or {}
itemData.slot = itemData.id or itemData.slot
cb(src, itemData)
end
QBCore.Functions.CreateUseableItem(itemName, func)